pwalter83 (1/29/2013)
Thanks Sean,
I have come to a point where I need to add the sql code within this:
---------------------------------------
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub
---------------------------------------
The SQL code would be as you suggested- "select Columns from MyTable where Col1 = Combobox 1 and Col2 = Combobox 2" but I dont know what vb.net syntax I need to enter this in.
Any suggestions would be welcome. Thanks,
Paul
I would make two suggestions. First give your button a name that means something. Button1 is like calling a column Column1 in sql, maybe something like btnSearch. Not naming your controls is a habit that is really tough to break unless you start early.
Secondly, don't run that sql code. Instead execute a stored procedure and pass the combobox values as parameters. Look up the syntax with google/bing/whatever. There are a number of ways to query data from the database with .NET.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/