World's Originating Website
Well Come To The World's Originating Websites Of Free Tricks
World's Originating Website

Gprs trick , Ring Tones , Games ,Apps And Many More

You are not connected. Please login or register

ASP.NET DataBase Connectivity

Go down  Message [Page 1 of 1]

1default ASP.NET DataBase Connectivity on Mon May 23, 2011 2:41 pm


bounce bounce Here U got All Type of DataBase Connectivity for ASP.NET bounce bounce



Simple way for ASP.Net 2.0 access database connection is DSN.
You can use OBDC drivers for Ms Access Database connection.
ODBC provides Microsoft Access Drivers (*.mdb).

Just create DSN on web server through Data Sources (ODBC). Select the Ms Access Database file path by browsing it.

In ASP.Net 2.0 save your connection string AppSettings section of web.config file:

<add key="myDSN" value="DSN=myDSN"/>

DSN (Data Source Name):
Enter the data source name created in ODBC connectivity.

Import Namespaces for ODBC:

Imports System.Data
Imports System.Data.Odbc

Source code below shows the use of ODBC to connect to Ms Access Database:

' Access Database ODBC connection string
Dim connStr As String = ConfigurationManager.AppSettings("myDSN").ToString()

' Object created for Odbc Connection
Dim myAccessConnection As New OdbcConnection(connStr)

' If condition that can be used to check the access database connection
' whether it is already open or not.
If myAccessConnection.State = ConnectionState.Closed Then
End If

' Message that displays the access database connection state
' 1 for open
' 0 for closed
Response.Write("ASP.Net Access Database Connection State: <b>" & myAccessConnection.State & "</b>")

' If condition to check the access database connection state
' If it is open then close it.
If myAccessConnection.State = ConnectionState.Open Then
End If


Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum