Copy Access table structure and constraints using C# or SQL

前端 未结 2 1945
感情败类
感情败类 2020-12-20 07:15

Can someone tell me how to copy an MS Access table\'s table structure and all its constraints, keys, and etc. using .NET or SQL? I have searched and found a number of ways o

相关标签:
2条回答
  • 2020-12-20 07:55

    I would use the upsize wizard with MS Access

    http://support.microsoft.com/kb/237980

    0 讨论(0)
  • 2020-12-20 08:18

    You can "export" to the same database, which will create a copy with all indexes etc, but not relationships.

            // Start a new instance of Access for Automation
            oAccess = new Access.Application();
    
            // Open a database
            oAccess.OpenCurrentDatabase(@"z:\docs\test.accdb");
            oAccess.DoCmd.TransferDatabase(
                Access.AcDataTransferType.acExport,
                "Microsoft Access",
                @"z:\docs\test.accdb",
                Access.AcObjectType.acTable, 
                "table1",
                "newtable",true,false);
    
    0 讨论(0)
提交回复
热议问题