Hey All,
This is really simple basic question, and it's just so I can start to learn about MVS.
I have a sql-database called "Test" with a Table called "Agents" with just three colulms "ID", "FNAME" and "LNAME".
On the Default Page I have three Textboxes and a submit Button,
All I want to do is type "Select" criteria in Textbox1 and have Textbox2 Display the "Fname" and Textbox3 Display the "Lname".
(Using VB in ASPX)
Dim
iAsNew SqlDataSource()i.ConnectionString = ConfigurationManager.ConnectionStrings(
"Test").ToString()i.SelectCommandType = SqlDataSourceCommandType.Text
i.SelectCommand = ((((((Now What?)))))))
EndSub
PLease Help, Thanks in advance
A...
"SELECT FName, LNameFROM AgentsWHERE ID = " + TextBox1.Text.Trim()
Above I am assuming that user are trying to search through the ID. Maybe you also should make the other textboxes as label, because user's are not allowed to type anything there. Just a thought.
Anyway, hope this helps. Good luck.
|||Alway use Parameterized Queries unless you don't care SQL injection. This article should help:Using Parameters with the SqlDataSource Control
No comments:
Post a Comment