Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i would like Use a object value(TextBox) in DataSet Query !

my mean when i insert a new Query to Data set (FillBy...) i would like Use a Textbox Value
Example :
VB
Select * From Login Where Username='"& Textbox1.text &"'


i cant Use Textbox in Query Builder of DataSet , How can i do it ?!

Thank you
Posted

1 solution

As a rule of thumb, you should not compose your query out of the data such as TextBox.Text. Instead, you should create one or more parametrized queries, create one or more database Command and re-use it by passing parameters from your data. You did not tell us what database provider you want to use; and I don't want to give you examples of all possible cases, as different mechanisms are used for different database providers: it can use named or positional correspondence between formal query parameters and objects.

See http://msdn.microsoft.com/en-us/library/yy6y35y8.aspx[^].

—SA
 
Share this answer
 
Comments
Monjurul Habib 24-Dec-11 2:42am    
5!
Sergey Alexandrovich Kryukov 24-Dec-11 16:55pm    
Thank you, Monjurul.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900