-
SQL Querie
Hay all
i want to query some data from a database, but not sure how to do it.
i have a Form with data bound to textBoxes. To do this i Configured a oleDbDataAdapter with the following SQL statement:
SELECT Address, DateOfBirth, DateOfEmployment, EmployeesID, FirstName, LastName, Notes, PhoneNumber, PostCode, Title
FROM Employees
all the above does is select and display all the fields from the employee Database
After configuring the oleDbDataAdapter i then generated a DataSet called objdsEmployee
The textboxes are bount to fields in the database:
Employee Database fields:
- EmployeesID
FirstName
LastName
Title
DateOfBirth
Address
PostCode
PhoneNumber
DateOfEmployment
Notes
All the above works fine but... i want to SELECT data WHERE the membersID is equla to TextBox1
im not sure how to do this could any 1 help?
thanks
-
why dont you use a SqlDataAdapter instead?
you would put it in the textbox1 lost focus or on a button click event to fill the dataset based on the text in the box.
i would do it like this
sqlEmployees.parameters("@ID").value=textbox1.text
sqlEmployees.fill(Dataset)
textbox2.text=dataset.tables(0).Rows(0).item("ColumnName")
just add the same row as above for each textbox changing the box no and the ColumnName.
if you need anymore help just ask
-
:D
“SELECT Address, DateOfBirth, DateOfEmployment, EmployeesID, FirstName, LastName, Notes, PhoneNumber, PostCode, Title
FROM Employees where EmployeesID = ‘“ & TextBox1.text & “’ “
Here a string sql statement!
:D
-
i would use a sqlAdapter but i aint got an sql server to store my database. i got SQL Server 2002 Developers edition but i cant get it to work dunno why!