TextBox Control Using Datasets and Data Adapters
Submitted by admin on Wednesday, June 3, 2009 - 12:01.
This tutorial is part of Database Programming Made Easy Series.
In this tutorial you'll learn how to retrieve and save data back to the database using Datasets and Data Adapters.
Microsoft Access database and Microsoft SQL Server sample is provided.
Previous: Using Data Readers and ExecuteNonQuery
Comments
help please
I have made an oledb connection b/w mySQL & Visual c++ Windows form in VS 2005 and was successful in displaying the 5 fields of the db created in mySQL.
I used the command this->oledbdataadapter1->(ds,"tablename").
But I'm deep trouble that i cannot procced ie; navigate the form using the buttons created even after trying lot many synatxes.
Will you please help me out with the exact syntax/command by which i can get the navigation of fields done.
The textboxes of these fields have already been correctly mapped to their 'text' field in databinding 'property' of each of them.
Expecting a reply...and moreover I would be thankful to get a personal mail.
[email protected]
regards
Bharat
Little help with search query
Hi there, I know this is quite old but I've been searching for days on how to work visual basic and database, so far this is the best tutorial I've found, I'm new to programming, the only knowledge I know is things I've tried and learnt from tuts.
My question is, How can I write the code so that I can search and retrieve information from the database but using any of the textbox controls I have.
for instance I have 5 rows; costumer name, phone number, account number, msid, fees.
with your code I can input the name and retrieve all the other info, but what if i want to search by phone number? or account number, or even msid?
is it possible? and how?
I tried
- If txtCName.text isNot "" Then
- Dim sqlQRY As String = "SELECT * FROM Customers WHERE CNAME = '" & txtCName.text & "'"
- Else If txtPhone.text isNot "" Then
- Dim sqlQRY As String = "SELECT * FROM Customers WHERE PNUMBER = '" & txtCName.text & "'"
- Else If txtAccount.text isNot "" Then
- Dim sqlQRY As String = "SELECT * FROM Customers WHERE ACCOUNT = '" & txtAccount.text & "'"
- End If
- '--then the rest of your code
- 'Create connection
- Dim conn As OleDbConnection = New OleDbConnection(cnString)
- Try
- ' Open connection
- conn.Open()
- 'create data adapter
- Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY, conn)........
- But I get this error
- "Error 1 'sqlQRY' is not declared. It may be inaccessible due to its protection level. E:\Visual Basic Projects\WorkSummary\WorkSummary\FTMP.vb 44 63 WorkSummary"
- I appreciate all the help you can give me, thank you so much.
Add new comment
- Add new comment
- 48 views