?
Solved

how do i populate a text box from a dataset and bind the text box to the dataset

Posted on 2006-04-21
5
Medium Priority
?
185 Views
Last Modified: 2010-05-18
i am trying to populate a dataset with a stored procedure that will fill a group of controls on a form such as textboxes and combo boxes.
the problem i am having is that i cannot figure out the syntax to populate the text boxes with the fields required and bind the textboxes to the dataset. i am also going need navigation controls to sift through the records the the query returns. any help or code examples would be great

thanx

makie1908
0
Comment
Question by:mackie1908
  • 3
  • 2
5 Comments
 
LVL 6

Assisted Solution

by:hatem72
hatem72 earned 1000 total points
ID: 16512805
0
 
LVL 6

Accepted Solution

by:
hatem72 earned 1000 total points
ID: 16512844

Sample Chapter 10 ADO.NET Data-Binding in Windows Forms
http://www.microsoft.com/mspress/books/sampchap/4825.asp#samplechapter

0
 

Author Comment

by:mackie1908
ID: 16516311
guys i have managed to bind the control with your help but i am now getting a new error.  below is the sub taht is populating the textboxes in the form. but now i am getting a new error "cannot bind to property or column location on datasource. " could someone please help me with what i am doing wrong.

 Private Sub QueryByLocation2(ByVal cn As SqlConnection)
        Dim cmd As New SqlCommand
        Dim da As SqlDataAdapter
        Dim ds As New DataSet
        Dim newBinding As System.Windows.Forms.Binding

        newBinding = New System.Windows.Forms.Binding("Text", ds, "Location")

        cmd = cn.CreateCommand
        cmd.CommandText = CommandType.StoredProcedure
        cmd.CommandText = "QueryByLocation '" & LocationName.Text & "'"
        cmd.ExecuteNonQuery()

        da = New SqlDataAdapter(cmd)
        da.Fill(ds)

        LocationName.DataBindings.Clear()
        LocationName.DataBindings.Add(newBinding)

        cmd.Dispose()
        cmd = Nothing
        da.Dispose()
        da = Nothing
        ds.Dispose()
        ds = Nothing
       
    End Sub
0
 

Author Comment

by:mackie1908
ID: 16516419
sorry needed to add if i the Locations.Location (which is my table name) to my databinding i get an error saying "cannot create a child list for field locations" how do i get around either problem to get the data into my text box
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question