|
-
Mar 2nd, 2004, 07:58 AM
#1
Thread Starter
Addicted Member
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
-
Mar 2nd, 2004, 08:28 AM
#2
Lively Member
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
-
Mar 2nd, 2004, 08:31 AM
#3
Hyperactive Member
“SELECT Address, DateOfBirth, DateOfEmployment, EmployeesID, FirstName, LastName, Notes, PhoneNumber, PostCode, Title
FROM Employees where EmployeesID = ‘“ & TextBox1.text & “’ “
Here a string sql statement!
Last edited by mudfish; Mar 2nd, 2004 at 07:22 PM.
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Mar 2nd, 2004, 12:51 PM
#4
Thread Starter
Addicted Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|