asp.net - Connection String to access 2007 -



asp.net - Connection String to access 2007 -

im using code connect access 2007 database :

public void retrievedata(){ oledbconnection conn=null; oledbdatareader reader=null; string strconnection= @"provider=microsoft.ace.oledb.12.0;data source=c:\\users\\pc\\documents\\school.accdb;persist security info=false;"; seek { conn = new oledbconnection(strconnection); conn.open(); oledbcommand cmd = new oledbcommand("select * class", conn); reader = cmd.executereader(); datalist1.datasource = reader; datalist1.databind(); } grab (exception e) { response.write(e.message); response.end(); } { if (reader != null) reader.close(); if (conn != null) conn.close(); } }

but when run it jus give blank page.in debug mode can see database property of conn empty "" problem?

in web.config

<connectionstrings> <!-- connection string declared connecting web application ms access 2007 --> <!-- connection string ms access 2007 accdb file --> <add name="accessconnectionstring" connectionstring="provider=microsoft.ace.oledb.12.0;data source=|datadirectory|db1.accdb;persist security info=false;jet oledb:database password=;" providername="system.data.oledb" /> </connectionstrings>

and code behind utilize this

import namespaces using system.data.oledb; // access connection string stored in web.config file. oledbconnection mydataconnection = new oledbconnection(configurationmanager.connectionstrings["accessconnectionstring"].connectionstring);

reply if useful or not

asp.net ado.net

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -