Sunday, July 22, 2007
First add a data grid view to the form
then go to the code file
on a buttons click event add the following code
U need to add the header named
using System.Data.OleDb;
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\test.mdb;Jet OLEDB:Database Password=password");;
String queryString ="select UserID from UserTable where USerID > 2";
OleDbDataAdapter da = new OleDbDataAdapter(queryString, conn);
DataSet ds = new DataSet();
da.Fill(ds, "UserTable");
dataGridView1.DataSource = ds.Tables["UserTable"].DefaultView;
}
that's it. U r done. U can now add your custom query and use the data grid to show your results.
Enough for today. :D
Some links
http://www.codeproject.com/csharp/UsingDataGrid.asp
http://www.google.com/search?q=c%23+show+data+in+a+datagrid&btnG=Search&hl=en
http://www.c-sharpcorner.com/UploadFile/mahesh/DataGrid11282005234057PM/DataGrid.aspx
Your example was the only one that got me going! I am SO THANKFUL!!
-Mert Man
GridView1.DataBind();
www.richonet.com
www.bwtrp.com
www.oracledba.in
www.richonet.com
www.bwtrp.com
www.oracledba.in
For example, there is 10 rows in a table. When i run the app i'll pass 5th record's value so it shld show all data of tbl starting from 5th row.