我在 VB.net 中有一个程序,运行时确定表是否存在。如果它不存在,我想在 SQL Server 上创建一个与本地 FoxPro 表具有相同架构的表。这是可以做的事情吗?
这是我到目前为止所拥有的。现在它只是从 Visual Foxpro 表中获取架构并显示它。不知道从这里去哪里。有任何想法吗?
Private Sub dwprm01()
Try
Dim tableName As String = "dwprm01"
Dim tableExists As Boolean = False
Dim foxConn As New OleDbConnection("Provider=vfpoledb.1;Data Source=Z:\update_dwprm01\" & tableName & ".DBF;Collating Sequence=general;")
sConn.Open()
Dim restrictions(3) As String
restrictions(2) = tableName
Dim dbTbl As DataTable = sConn.GetSchema("Tables", restrictions)
Console.WriteLine("Checking if " & tableName & " exists")
If dbTbl.Rows.Count = 0 Then
'Table does not exist
tableExists = False
Console.WriteLine(tableName & " does not exist") …Run Code Online (Sandbox Code Playgroud)