SqlClient.SqlConnection VB.net CF

M

Mat Murdock

I purchased Larry and Dan's cf.net book and I'm having a problem with
the 9-3 example. The example shows you how to connect to a SQL 2000
server and then populate a listbox with some data. When I run it I get
the following error:
An unhandled exception of type 'System.TypeLoadException' occurred in
System.Windows.Forms.dll

I have tried this on three different machines. Two had VS 2003 and one
had VS 2005 beta 2 and I'm getting the same error. Here is my code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim cn As System.Data.SqlClient.SqlConnection
Dim cmd As System.Data.SqlClient.SqlCommand
Dim dr As System.Data.SqlClient.SqlDataReader

Try
cn = New System.Data.SqlClient.SqlConnection( _
"user
id=sa;password=xxxxxxx;database=Northwind;server=xxx.xxx.x.x;")

cmd.CommandText = "Select * From Customers"
cmd.Connection = cn
dr = cmd.ExecuteReader


While dr.Read()
ListBox1.Items.Add(dr("CompanyName"))
End While
Catch
Finally
dr.Close()
cn.Close()
End Try

End Sub


I am using SQL server 2000. I can browse the internet on the emulator.
I can login to the sql server with query analyzer using the same
credentials I use on this project. Any help would be most appreciated.

Sorry for the long post,

Mat
 
I

Ilya Tumanov [MS]

Please provide more details including full type name (with PKT) and stack
trace.

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/microsoft.public.dotnet.framework.compactframework?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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top