Databinding textbox argument exception

D

daniel.irwin

Hi All,

Getting a problem when trying to bind data to a textbox in a smart
device application using visual studio 2003, CF 1.0 and win ce 4.2.
Below is the code:

strSQL = "SELECT * FROM Visit WHERE SiteID= '"
& strSiteName & "' AND D_Date = '" & strDate & "' AND UserID = '" &
strUserName & "'"
cmd.CommandText = strSQL

da = New SqlCeDataAdapter(cmd)
ds = New DataSet
da.Fill(ds, "SiteVisit")
txtSourceID.DataBindings.Add("Text",
ds.Tables("SiteVisit"), "SourceID")

When trying to bind I get an argument exception error with null
reference? This same code works fine in my test windows application,
so what could the problem be? I even know that the data is there as
databinding to a datagrid works fine, it's just textboxes that seem to
be a problem. Any ideas would be appreciated!

Cheers

Dan
 
I

Ilya Tumanov [MS]

Probably you don't have a table called "SiteVisit" in the DataSet or there's
no column called "SourceID" in it.



I'm also confused by "I get an argument exception error with null
reference". Are you getting ArgumentException or are you getting
NullRefereceException?


--
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).
 
D

daniel.irwin

Hi Ilya,

Thanks for the response. Thankfully I've found the problem and it
actually had nothing to do with the databinding, the problem lay in a
splash screen thread which was casuing the debugger to 'jump'!
Unbelievable that I've spent this long looking at a problem that didn't
exist!!

Thanks again anyway.

Dan
 
D

daniel.irwin

Hi Ilya,

Thanks for the response. Thankfully I've found the problem and it
actually had nothing to do with the databinding, the problem lay in a
splash screen thread which was casuing the debugger to 'jump'!
Unbelievable that I've spent this long looking at a problem that didn't
exist!!

Thanks again anyway.

Dan
 

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