Imports System.Data.SqlServerCe
Public Class SQLCeCon
Private SQLCeCon As New SqlCeConnection("Data Source=au2015.sdf;Persist Security Info=False;")
Private SQLCeCmd As SqlCeCommand
Public SQLCeDA As SqlCeDataAdapter
Public SQLCeDT As DataTable
Public Params As New List(Of SqlCeParameter)
Public RecordCount As Integer
Public Exception As String
Public Sub ExecQuery(Query As String)
'Reset query stats'
RecordCount = 0
Exception = ""
Try
SQLCeCon.Open()
SQLCeCmd = New SqlCeConnection(Query, SQLCeCon)
Params.ForEach(Sub(p) SQLCeCmd.Parameters.Add(p))
Params.Clear()
SQLCeDT = New DataTable
SQLCeDA = New SqlCeDataAdapter(SQLCeCmd)
RecordCount = SQLCeDA.Fill(SQLCeDT)
Catch ex As Exception
Exception = ex.Message
End Try
If SQLCeCon.State - ConnectionState.Open Then SQLCeCon.Close()
End Sub
End Class
我在New SqlCeConnection(Query, SQLCeCon)
收到错误消息,显示“重载解析失败,因为无法访问' NEW
'接受这个数量的论点“。
我不知道这意味着我对此事的研究尝试没有帮助。我是这个论坛的新手,也是vb.net的初学者