PC Review


Reply
Thread Tools Rate Thread

Can't connect to sql 2000 from WinCe 4.1

 
 
=?Utf-8?B?YWx1cg==?=
Guest
Posts: n/a
 
      10th Jun 2005
I have device Symbol MK1000 with wince 4.1 and sql 2000 on desktop.
I need get some data from sql 2000.
Where is class.
Imports System.Data
Imports System.Data.SqlClient

Public Class Sql
Public Function GetPublishersDS() As DataSet
Dim ds As New DataSet
Dim strCn As String = "Server=11.0.3.76;Database=pubs;" & _
"Integrated Security=SSPI;User Id=COMP/test;Password=test"
Try
Dim sqlConn As New SqlConnection(strCn)
sqlConn.Open()
Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors", sqlConn)
sqlDA.Fill(ds)
sqlConn.Close()
Return ds
Catch ex As Exception
ErrTrap(ex)
End Try
End Function

Public Function GetPublishersDS1() As DataSet
Dim ds As New DataSet
Dim strCn As String = "Server=11.0.3.76;Database=pubs;" & _
"Integrated Security=SSPI;UID=sa;Password=sa"
Dim str1 As String
Try
Dim sqlConn As New SqlConnection(strCn)
sqlConn.Open()

Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors", sqlConn)

sqlDA.Fill(ds)
sqlConn.Close()

Return ds
Catch ex As SqlException
Dim e As SqlClient.SqlError
For Each e In ex.Errors
str1 = str1 & vbCrLf & e.Message
Next
MsgBox(str1)
Catch ex As Exception
ErrTrap(ex)
End Try
End Function

Public Function GetPublishersDS2() As DataSet
Dim ds As New DataSet
Dim strCn As String

strCn = "data source=11.0.3.76;" & _
"initial catalog=pubs;" & _
"user id=sa;" & _
"pwd=sa;" & _
"workstation id=COMP;" & _
"packet size=4096;" & _
"persist security info=False;"
Dim str1 As String
Try
Dim sqlConn As New SqlConnection(strCn)
sqlConn.Open()

Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors", sqlConn)

sqlDA.Fill(ds)
sqlConn.Close()

Return ds
Catch ex As SqlException
Dim e As SqlClient.SqlError
For Each e In ex.Errors
str1 = str1 & vbCrLf & e.Message
Next
MsgBox(str1)
Catch ex As Exception
ErrTrap(ex)
End Try
End Function
End Class

I call methods from form on emulator and real device, but get
PlatformNotSupportedException.
The same code work fine on PocketPC.!!!
What to do?
 
Reply With Quote
 
 
 
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      10th Jun 2005
That usually means you're trying to retrieve strings in locale which is not
supported by this particular device.

That might happen if you keep none-Unicode strings in the database.

You can either get rid of these strings, use the device which supports this
locale or switch to Unicode.



Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"alur" <(E-Mail Removed)> wrote in message
news:5C7A020E-4D90-4BD0-BE42-(E-Mail Removed)...
>I have device Symbol MK1000 with wince 4.1 and sql 2000 on desktop.
> I need get some data from sql 2000.
> Where is class.
> Imports System.Data
> Imports System.Data.SqlClient
>
> Public Class Sql
> Public Function GetPublishersDS() As DataSet
> Dim ds As New DataSet
> Dim strCn As String = "Server=11.0.3.76;Database=pubs;" & _
> "Integrated Security=SSPI;User Id=COMP/test;Password=test"
> Try
> Dim sqlConn As New SqlConnection(strCn)
> sqlConn.Open()
> Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors",
> sqlConn)
> sqlDA.Fill(ds)
> sqlConn.Close()
> Return ds
> Catch ex As Exception
> ErrTrap(ex)
> End Try
> End Function
>
> Public Function GetPublishersDS1() As DataSet
> Dim ds As New DataSet
> Dim strCn As String = "Server=11.0.3.76;Database=pubs;" & _
> "Integrated Security=SSPI;UID=sa;Password=sa"
> Dim str1 As String
> Try
> Dim sqlConn As New SqlConnection(strCn)
> sqlConn.Open()
>
> Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors",
> sqlConn)
>
> sqlDA.Fill(ds)
> sqlConn.Close()
>
> Return ds
> Catch ex As SqlException
> Dim e As SqlClient.SqlError
> For Each e In ex.Errors
> str1 = str1 & vbCrLf & e.Message
> Next
> MsgBox(str1)
> Catch ex As Exception
> ErrTrap(ex)
> End Try
> End Function
>
> Public Function GetPublishersDS2() As DataSet
> Dim ds As New DataSet
> Dim strCn As String
>
> strCn = "data source=11.0.3.76;" & _
> "initial catalog=pubs;" & _
> "user id=sa;" & _
> "pwd=sa;" & _
> "workstation id=COMP;" & _
> "packet size=4096;" & _
> "persist security info=False;"
> Dim str1 As String
> Try
> Dim sqlConn As New SqlConnection(strCn)
> sqlConn.Open()
>
> Dim sqlDA As New SqlDataAdapter("SELECT * FROM authors",
> sqlConn)
>
> sqlDA.Fill(ds)
> sqlConn.Close()
>
> Return ds
> Catch ex As SqlException
> Dim e As SqlClient.SqlError
> For Each e In ex.Errors
> str1 = str1 & vbCrLf & e.Message
> Next
> MsgBox(str1)
> Catch ex As Exception
> ErrTrap(ex)
> End Try
> End Function
> End Class
>
> I call methods from form on emulator and real device, but get
> PlatformNotSupportedException.
> The same code work fine on PocketPC.!!!
> What to do?



 
Reply With Quote
 
alur
Guest
Posts: n/a
 
      16th Jun 2005
Thanks for reply.
I create 3 new databases (Northwind) with collations
(Latin1_General_CI_AS, Latin1_General_CI_AI, Latin1_General_CS_AS)
Now i can connect to database, but can't get information.
When i make calls, I ger error NullReferenceException.
What to do?
I don't have any ideas.

Public Function GetDsByConnect(ByVal con As SqlConnection) As DataSet
Dim str1 As String
Dim ds As DataSet
Try
ds = New DataSet
Dim sqlDA As New SqlDataAdapter("SELECT * FROM Orders",
con)

sqlDA.Fill(ds)'Error throws where
con.Close()

Return ds
Catch ex As SqlException
Dim e As SqlClient.SqlError
For Each e In ex.Errors
str1 = str1 & vbCrLf & e.Message
Next
MsgBox(str1)
Catch ex As Exception
ErrTrap(ex)

End Try
End Function

Public Function GetRdByConnect(ByVal con As SqlConnection) As
SqlDataReader
Dim str1 As String
Try
Dim com As SqlCommand
If con Is Nothing Then
Return Nothing
End If
If con.State <> ConnectionState.Open Then
Return Nothing
End If
Dim rd As SqlDataReader
com = con.CreateCommand()
com.CommandType = CommandType.Text
com.CommandText = "select * from Orders"
rd = com.ExecuteReader(CommandBehavior.SingleResult)'Error
throws where
rd.Close()
While rd.Read
MsgBox(rd.GetSqlString(0))
End While
Catch ex As SqlException
Dim e As SqlClient.SqlError
For Each e In ex.Errors
str1 = str1 & vbCrLf & e.Message
Next
MsgBox(str1)
Catch ex As Exception
ErrTrap(ex)
End Try
End Function

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't connect visual studio 2005 to my wince 5.0 device =?Utf-8?B?R2VvZmZyZXkgQ2FsbGFnaGFu?= Microsoft Dot NET Compact Framework 2 10th May 2007 11:09 AM
How connect usb-camera with dotnet or wince 4.2? Andrey Kaplun Microsoft Dot NET Compact Framework 3 3rd Jan 2006 08:40 PM
Cannot connect to WinCe device with Vs2003 Ide =?Utf-8?B?Sm9obiBPbGJlcnQ=?= Microsoft Dot NET Compact Framework 1 20th Oct 2005 10:18 PM
Can't connect to sql 2000 from WinCe 4.1 alur Windows XP 0 10th Jun 2005 12:18 PM
WinCe.Net connect to SQL Server 7 ? Simon Microsoft Dot NET Compact Framework 2 3rd May 2004 07:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 PM.