Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataBase Connection

Status
Not open for further replies.

fsqueeen

Programmer
Jul 8, 2002
43
MY
i met 2 type of connection style:

1)
<%
'--- Connection to DataBase

Dim objConn
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; &quot; & _
&quot;Data Source=C:\Inetpub\
Const adOpenStatic = 3
Const adOpenForwardOnly = 3
Const adLockOptimistic = 3

%>

2)
<%
Dim MyDB, MyDSN, MyTable

MyTable = &quot;loan&quot;
set MyDB = Server.CreateObject(&quot;ADODB.Connection&quot;)

MyDSN = server.MapPath(&quot;database/cisco.mdb&quot;)
MyDB.Open &quot;driver={Microsoft Access Driver (*.mdb)};dbq=&quot; & MyDSN & &quot;;&quot;

%>

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, &quot;recordset.addnew&quot; 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?
 
sorry just saw that conn should be MyDB
Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
MyDB = Server.CreateObject(&quot;ADODB.Connection&quot;)

habit! [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
=)

ic.
no, u make me understand sth important concepts about ASP which i always confuse in.

Thanx a lot.
I will get to you soon when i face problem again.
Hope you wun feel that i'm veli troublesome and stupid..=p

 
it takes awhile to get it all down. trust me!

There's a lot of really good programmers in this forum that are always here to help out and from what I've seen they all come to help so don't ever feel like you're asking questions that are troublesome or stupid.
[roll2] [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top