0

我在将装有 Windows CE 6.0 的设备连接到 Microsoft SQL Server 2008 时遇到问题。

这是实现连接的程序片段

Dim consql As SqlConnection = Nothing
consql=New SqlConnection("Server=ip\SQLEXPRESS;Database=db;User Id=sa;Password=sapass;")
consql.Open()
Dim comsql As New SqlCommand()
comsql.Connection=consql
comsql.CommandText="Select * from PRACOWNICY"
Dim adaptsql As new SqlDataAdapter()
adaptsql.SelectCommand=comsql
Dim datpubs As New Data.DataSet()
adaptsql.Fill(datpubs, "PRACOWNICY")

在我的电脑上这个程序运行良好,但在 Win CE 上它会导致错误:

错误SqlException 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(
)在 System.Data.SqlClient.SqlInternalConnection.OnError (SqlException 异常, TdsParserState 状态) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 在 System.Data.SqlClient.SqlConnection.OnError ( SqlException
异常, TdsParserState 状态) .Data.SqlClient.TdsParser.Connect(String host, SqlInternalConnection connHandler, Int32 timeout) 在 System.Data.SqlClient.SqlInternalConnection.OpenAndLogin() 在 System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions) 在 System .Data.SqlClient.SqlConnection.Open() 在 datbase1.MainForm.Button1Click(Object sender, EventArgs e) 在 System.Windows.Forms.Control.OnClick(EventArgs e)







在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)
在 System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam , Int32 lParam)
在 Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
在 System.Windows.Forms.Application.Run(Form fm)
在 datbase1.MainForm.Main()

请尽快回复 E-cma

4

0 回答 0