SQL statement for databinding, VB 2005

wongth7

Member
Joined
Jun 16, 2009
Messages
7
Programming Experience
Beginner
hi...let say in my program..there's 2 windows, the login page and the main page...when user login from the main page with username "david"...i want those textboxes in the main page to display only david's data..

-my main page is using databinding method to link to those textboxes

-somewhere in my userDataset...it allows me to type the SQL statement.
there, i tried to type in something like

SELECT columnname1, columnname2FROM tablename Where (username =' & frmLogin.txtUsername.text & ')

but it fails to load the data....am i on the right track????...how do i solve my problem???

- i need to capture the txtUsername.text from the login page for my sql statement ...is that possible?????????

here i upload a zip file contains a sample from my real project..please have a look.
 

Attachments

  • TEST.zip
    84.2 KB · Views: 20
Last edited by a moderator:
You can't refer to frmLogin in your query because the TableAdapter has no idea what frmLogin is. You need to add a new query to your TableAdapter and just add a @UserName parameter. You would name the query FillByUserName. In your form you then call FillByUserName on your TableAdapter instead of calling Fill, and you pass the user name as an argument. That value then gets passed on to the command and gets inserted into the SQL code.
 

Latest posts

Back
Top