How to save the result of a MS-Access select query in variables in C#.net? -


my question simple don't know how query is:

" select * table1 id =" + textbox1.text; 

and want save result in variables table of query has 5 columns means want 5 variables save results don't know how can database in ms-access

firstly need know, how make oledbconnection in c#.

you don't need create variables!. can directly assign rows or selected 1 one of many datacontrols available in asp.net , winforms both.

datacontrols automatically show db.table data in tabular layout on page or form. can control of automatically created layout.

you can fetch data db , create dataset this:

string query = "select * table1 id=?";  oledbconnection odc = new oledbconnection(strconn); odc.open(); oledbdataadapter dadapter = new oledbdataadapter(); oledbcommand cmd = new oledbcommand(query,odc);  cmd.parameters.add("?", oledbtype.bstr, 5).value ="asdf"; dadapter.selectcommand = cmd;  ds = new dataset(); dadapter.fill(ds);  datagridview1.datasource = ds.tables[0]; 

now in above code, strconn connectionstring access db file. every kind of storage requires unique kind of connectionstring. can find out 1 suitable here.

once clear that. need learn asp.net datacontrols , winforms datagridview , many others.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -