Question VS2008 and SQLce WinMobile 5.0

motoburn

Member
Joined
Jun 15, 2010
Messages
17
Location
Collinwood, TN
Programming Experience
Beginner
Hello, new to the forums and new to vb.net.

I am trying to populate a set of text boxes with data from an SQLce table. I can do this fine using the auto-generated tableadapters and binding sources. The trouble is, I need to display a single record from the table with a WHERE clause to find the key in another text box.


I have this code (which does not work) that is the best I can figure out to make this happen...

VB.NET:
    Public Sub tdParentQueryAdapter()
        Dim intKey As Int64
        intKey = txtKey.Text
        Dim strSqltdParent As String
        strSqltdParent = "SELECT * FROM tdParent WHERE tdParent.[key]='" & intKey & "';"
        Dim tdPqry As New SqlCeDataAdapter(strSqltdParent, New SqlCeConnection("Data Source=\Program Files\SmartDeviceProject1\TallyDB.sdf"))


        Me.TextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "user", True))
        Me.TextBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "category", True))
        Me.TextBox3.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "categoryID", True))
        Me.TextBox4.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "ndate", True))
        Me.TextBox5.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "key", True))
        Me.TextBox6.DataBindings.Add(New System.Windows.Forms.Binding("Text", tdPqry, "custID", True))
    End Sub

It fails at the first "me.TextBox.Forms.Binding(etc...)"
The error says
Cannot bind to the property or column user on the DataSource. Parameter name: dataMember

The TroubleShooting Tips are of no help at all... directs me here

I am obviously not doing this correctly, but am not sure at this point how to do this. I have my Insert, Update, Delete transactions working. And can successfully export my data to ascii, but I need to retrieve this parent record for user confirmation and also Child table Inserts..

Thanks in advance for any direction.

-Chris
 
Oops (thank you to whoever put me in the correct forum)

Now that I am in the right area, I may have found the right solution in this thread

I will try the way Indyrob did his and see if it solves my problem. Sorry for any waste of time.
 
Back
Top