在vb:
db = New DBDataContext(c:\path\db.mdf)
如何编写类声明来声明DBDataContext:
Class DBDataContext
**what code goes here**
End Class
我在TableQ的LINQ-SQL中创建了一个dbml文件。有人可以给我提示,我可以通过它来制作这个Class语句。
答案 0 :(得分:0)
您是否在VB中寻找这样的示例:
Using db = New DbDataContext()
Try
db.Connection.Open()
db.Transaction = db.Connection.BeginTransaction()
Using command = db.Connection.CreateCommand()
command.Transaction = db.Transaction
command.CommandText = File.ReadAllText("/path/to/file.sql")
command.ExecuteNonQuery()
End Using
db.Transaction.Commit()
Catch e As Exception
db.Transaction.Rollback()
Throw e
Finally
db.Connection.Close()
End Try
End Using