我用的是VB.NET+SQL2000+SQLCE2.0
在用PPC访问服务器上的数据库时,在模拟器上跳出的问题是SQL Server不存在或访问被拒绝,在设备上(Symbol MC50)上是PlatformNotSupportedException。
但是我用rda访问时都是正常的。怎么回事呢。
程序:
Dim cn As System.Data.SqlClient.SqlConnection
Dim cmd As New System.Data.SqlClient.SqlCommand
Dim dr As System.Data.SqlClient.SqlDataReader
Try
cn = New System.Data.SqlClient.SqlConnection("user id=sa;password=12345678;database=dbtest;server=192.168.1.14")
cn.Open()
cmd.CommandText = "select * from students"
cmd.Connection = cn
dr = cmd.ExecuteReader
While dr.Read()
ListBox1.Items.Add(dr("Name"))
End While
Catch sqlex As Data.SqlClient.SqlException
MsgBox(sqlex.Message)
MsgBox(sqlex.Number)
MsgBox(sqlex.Source)
MsgBox(sqlex.InnerException)
Catch ex As Exception
MsgBox(ex.Message)
MsgBox(ex.InnerException)
Finally