Hi,
I am working on c# .net windows application.
In a window form i have one textbox control, and a button.
when i click the button i want to search the database using the textbox value.
how to accomplish this. please help ...
thanks.
2 Replies - 29307 Views - Last Post: 06 March 2010 - 09:18 AM
#8
Re: Search database using textbox control values in c# .net windows applic
Posted 14 January 2009 - 01:54 PM
#9
Re: Search database using textbox control values in c# .net windows applic
Posted 14 January 2009 - 02:24 PM
First and foremost, you're going to have to show us what you've tried so far to accomplish this, to help with this here is a tutorial to help with the basics of working with SQL Server with C#.
[rules][/rules]
[rules][/rules]
#10 Guest_Tomi*
Re: Search database using textbox control values in c# .net windows applic
Posted 06 March 2010 - 09:18 AM
mohdabid, on 14 January 2009 - 12:54 PM, said:
Hi,
I am working on c# .net windows application.
In a window form i have one textbox control, and a button.
when i click the button i want to search the database using the textbox value.
how to accomplish this. please help ...
thanks.
I am working on c# .net windows application.
In a window form i have one textbox control, and a button.
when i click the button i want to search the database using the textbox value.
how to accomplish this. please help ...
thanks.
I wanted to figured this too. After failing Google-ing a clear way I build a method, a simple one.
/* variables explanation
The DataSet is > visitDataSet < change it to your own.
j > number of columns < change it to your own.
textBox1.Text > the text you're looking for < change it to your own.
label2 > represent the answer < change it to your own.
*/
int count=visitDataSet.Visits.Count;//saves how many rows in table
string find=null;
for (int i=0;i<=count-1;i++)
{
for(int j=0;j<=7;j++)
{
if (visitDataSet.Visits.Rows[i].ItemArray[j].ToString().Equals(textBox1.Text))
{ find += visitDataSet.Visits.Rows[i].ItemArray[j].ToString()+"\n";}
}
}
if (find == null)
label2.Text = "No records found";
else
label2.Text = find;
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|