|
-
Dec 11th, 2006, 09:41 PM
#1
Thread Starter
Fanatic Member
[2005] MS Access with .net 2.0?
hey guys, used to access ms sql servers, and I was just wondering on what would change when I need to use ms access instead with .net 2.0?
sample code for dtb connection with ms sql server:
Code:
String conString;
SqlConnection con;
ServerName = Server;
conString = "Data Source=" + Server + ";";
if (User == null)
{
conString += "Integrated security = true;";
}
else {
conString += "User ID="+ User +";";
conString += "Password=" + Password + ";";
}
try
{
con = new SqlConnection(conString);
con.Open();
tsStatus.Text = "Connection établie.";
ActivateControls();
}
(I know, sample is in c#, but w-e, post vb, .net is .net and this is the most popular thread... )
Also, if I need other objects instead of the System.Data.SqlClient library, please mention the references needed...
basically what I need to do is just to retreive rows from tables of an ms access file (in asp.net, but again w-e .net is .net )
-
Dec 11th, 2006, 10:05 PM
#2
Re: [2005] MS Access with .net 2.0?
ADO.NET is virtually identical regardless of the data source. For Access you use OleDb instead of SqlClient. Both namespaces have corresponding types, e.g. SqlConnection <=> OleDbConnection. See www.connectionstrings.com for the appropriate connection string format if required.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|