Hi. I'm using a datagridview to display data and make updates to my access database. I was able to display data from my database to the datagridview but it is not filtered. The datagridview displays all the records on my database. I tried using query builder to execute sql select statements that will filter the data and this is where I'm stuck. Im using a variable as a parameter to the sql statement and I dont know what syntax to use in Query Builder. I tried to use @varname, '" & varname & "', and ?varname but they are not recognized. Can someone pls tell me the correct syntax? Thanks!
Alphard
0
Newbie Poster
Recommended Answers
Jump to PostUse RowFilter property of DataView,
Dim Adp as New OledbDataAdapter("select * from tableName","Connection_String") Dim Dt as new DataTable Adp.Fill(Dt) Dim Dv as DataView Dv=Dt.DefaultView DataGridView1.DataSource=Dv Dv.RowFilter="ColName='Value'" 'OR Dv.RowFilter='ColName1>=10 and ColName1<=30 or ColName2 like 'A%'"
All 4 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
Alphard
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
Alphard
0
Newbie Poster
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.