i met 2 type of connection style:
1)
<%
'--- Connection to DataBase
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\Inetpub\
Const adOpenStatic = 3
Const adOpenForwardOnly = 3
Const adLockOptimistic = 3
%>
2)
<%
Dim MyDB, MyDSN, MyTable
MyTable = "loan"
set MyDB = Server.CreateObject("ADODB.Connection"
MyDSN = server.MapPath("database/cisco.mdb"
MyDB.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & MyDSN & ";"
%>
the 2nd one is my way whereas the other one was taken from a book.
my question:
- are these similar way?
- if so, y cant i use some function which used and worked properly with the 1 style?
eg: with 2 style, "recordset.addnew" is applicable, but for my way, it doesn't work. I use SQL.
- is it really the connection problem or is in fact the coding error?
1)
<%
'--- Connection to DataBase
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\Inetpub\
Const adOpenStatic = 3
Const adOpenForwardOnly = 3
Const adLockOptimistic = 3
%>
2)
<%
Dim MyDB, MyDSN, MyTable
MyTable = "loan"
set MyDB = Server.CreateObject("ADODB.Connection"
MyDSN = server.MapPath("database/cisco.mdb"
MyDB.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & MyDSN & ";"
%>
the 2nd one is my way whereas the other one was taken from a book.
my question:
- are these similar way?
- if so, y cant i use some function which used and worked properly with the 1 style?
eg: with 2 style, "recordset.addnew" is applicable, but for my way, it doesn't work. I use SQL.
- is it really the connection problem or is in fact the coding error?