Click to See Complete Forum and Search --> : How to read data from Database(MsAcess)


saimukesh
July 22nd, 2006, 06:11 AM
Hi,i want to read data from database by their fields.Suppose in my project i am having radiobutton list,after selecting one radiobutton that field data from the database shld be read....Here the field and radiobutton captions are same....So please help me....

Shuja Ali
July 22nd, 2006, 06:22 AM
Use System.Data.OleDB namespace to read the data from the MDB file. You should be looking at some tutorial on the web for ADO.NET.

eid1984
July 24th, 2006, 07:13 AM
http://www.codeproject.com/useritems/EasyDatabaseConnection.asp

eid1984
July 24th, 2006, 10:35 AM
hi.
here is the code can help you you but i uses sql connection:

string xx = RadioButtonList1.SelectedItem.Text.ToString();
string x = "select " + xx+" from customer";

SqlConnection con=new SqlConnection ("server=localhost;initial catalog=northwind;pwd=;uid=sa";

string sql="select " + xx+" from customer";
SqlDataAdapter dt=new SqlDataAdapter (sql,con);
DataSet ds=new DataSet ();
dt.Fill (ds);
DataGrid dg1=new DataGrid ();
dg1.DataSource =ds.Tables [0];
dg1 .DataBind ();

best wihes
tell me what happen with you with this code