i'm using C# and MS Access database..i want to search name or serial no using LIKE statement..but i don't know how to do it..and then after i search it will view the match that i search for..let's say i want to search a letter start with 'C', an then it will view all name or serial no that start with 'C'..i want to show it in gridview but i don't know how to do that:(..to search that i try to use textbox and a button search..after i click on button search it will view the match for the word that i enter..like in daniweb when we search a certain word it'll view by grid..i try to do like that but i don't know how to start..is there anyone that can suggest me any solving method..i'll appreciate that..:)
kayfar 0 Junior Poster in Training
Recommended Answers
Jump to Postfor that first create aconnection with the database. Then create one Adapter and fire a querry in your adpter and fill the dataset with adapter and give your gridview datasource that dataset.
e.g.OleDbConnection con=new OleDbConnection ("Connection String"); Con.OPen(); string str="Select [name] from [tabel] Where [name] like …
Jump to Postyes @angelicOne you are righ.Thanks
put this line whrn you create a instace of Dataset.i.e.
Dataset ds=new dataset();
ds.Clear();
then write all the code as i wriiten there and remove the line no. 5
Jump to Postyes first put the gridview on your form. then on button click event write the code.
Jump to Postat th general decalration define the
OleDbConnection con=new OleDbConnection();
OleDbDataAdapter da=new OleDbDataAdapter ();
DataSetc ds=new Dataset();
i think you did'nt add the namspace of Syste.Data Or System.Data.OleDbOleDbConnection con = new OleDbConnection(); con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\priteshv\\My Documents\\db1.mdb;Persist Security Info=False"; con.Open(); string str = "Select * …
All 13 Replies
pritesh2010 30 Posting Whiz in Training
AngelicOne 4 Posting Whiz
Lusiphur commented: Good use of gained knowledge :) +1
kayfar 0 Junior Poster in Training
pritesh2010 30 Posting Whiz in Training
kayfar 0 Junior Poster in Training
pritesh2010 30 Posting Whiz in Training
kayfar 0 Junior Poster in Training
kayfar 0 Junior Poster in Training
pritesh2010 30 Posting Whiz in Training
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster
kayfar 0 Junior Poster in Training
kayfar 0 Junior Poster in Training
kayfar 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.