Sample Code For Connection String In Asp to MsAccess Database and Mssql Server

Sample Code For Connection String In Asp to MsAccess Database

Example of a DSN connection
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=myCONNECTION.dsn"
objConn.Open
%>

Example of a DSN-Less connection
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("/YourdatabaseName.mdb") & ";"
objConn.Open
%>

Sample Code For Connection String In Asp to Mssql Server
The sample example code

Set objDBConn = Server.CreateObject("ADODB.Connection")

objDBConn.ConnectionString="driver={SQL Server};" _
& "server=myserver put the serverIP;" _
& "uid=mywebuser Database User ID;" _
& "pwd="YourPassword;"

objDBConn.Open
objDBConn.DefaultDatabase = "mydatabaseDatabaseName"

  • 101 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

Sample Email Code In .net

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SendMail.aspx.cs"...

Connection String in the .net for Ms Access and MSSQL Server

Connection String in the .net for Ms Access using System.Data.Odbc;OdbcConnection conn = new...

Powered by WHMCompleteSolution