|
 |
asp_database_setup thread: Chapter 9 AddNew but DNSless
Message #1 by mdehnel@a... on Sat, 23 Jun 2001 04:21:55
|
|
Page 307
<%
Dim oRS
Set oRS=Server.CreateObject("ADODB.Recordset")
oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
...
%>
how would this line look if this was a DNSless connection ????
I am assuming this is all I would have to change to make this work for a
DNSless connection.
Thanks
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 25 Jun 2001 11:22:27 +1000
|
|
Depends on what database you are using. When using an ODBC DSN-less
connection you need to supply the drive name you will be using. Have a look
here, and pick the one you need:
http://www.able-consulting.com/ado_conn.htm
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <mdehnel@a...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Saturday, June 23, 2001 4:21 AM
Subject: [asp_database_setup] Chapter 9 AddNew but DNSless
: Page 307
:
: <%
: Dim oRS
: Set oRS=Server.CreateObject("ADODB.Recordset")
: oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
: ...
: %>
:
:
: how would this line look if this was a DNSless connection ????
:
: I am assuming this is all I would have to change to make this work for a
: DNSless connection.
Message #3 by mdehnel@a... on Mon, 25 Jun 2001 17:36:30
|
|
Maybe I'm reading this wrong but this does not appear to be the connection in this case. I have
established my DNSless connection. This is subset of Recordset with a parameter for specifing a
connection to a specific table in a database for the purpose of adding a new record. Am I all wet?
> Depends on what database you are using. When using an ODBC DSN-less
> connection you need to supply the drive name you will be using. Have a
look
> here, and pick the one you need:
>
> http://www.able-consulting.com/ado_conn.htm
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ----- Original Message -----
> From: <mdehnel@a...>
> To: "ASP Database Setup" <asp_database_setup@p...>
> Sent: Saturday, June 23, 2001 4:21 AM
> Subject: [asp_database_setup] Chapter 9 AddNew but DNSless
>
>
> : Page 307
> :
> : <%
> : Dim oRS
> : Set oRS=Server.CreateObject("ADODB.Recordset")
> : oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
> : ...
> : %>
> :
> :
> : how would this line look if this was a DNSless connection ????
> :
> : I am assuming this is all I would have to change to make this work for
a
> : DNSless connection.
>
>
Message #4 by mdehnel@a... on Mon, 25 Jun 2001 18:53:24
|
|
> Page 307
>
> <%
> Dim oRS
> Set oRS=Server.CreateObject("ADODB.Recordset")
> oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
> ...
> %>
>
>
> how would this line look if this was a DNSless connection ????
>
> I am assuming this is all I would have to change to make this work for a
> DNSless connection.
>
> Thanks
I maybe answering my own question but I'm wondering if this is correct
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Session( ... DNSless connection ...)
Dim oRS
Set oRS=Server.CreateObject("ADODB.Recordset")
oRS.Open "people", conn, adOpenKeyset, adLockOptimistic
' Insert a record
oRS.AddNew
...
%>
Message #5 by "Alex Souza" <alexsouza@m...> on Mon, 25 Jun 2001 17:04:05 -0300
|
|
No DNSless connection it's like this:
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};server=brbebe04m;dbq=workdb;uid=sa;pwd="
You define directly to the connection object which driver to use and the
remaining parameters,
as usually... when you add the parameter DNS automatically assumes as a DNS
connection, an
item required in you ODBC.
Alex
Brazil
----- Original Message -----
From: <mdehnel@a...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Monday, June 25, 2001 6:53 PM
Subject: [asp_database_setup] Re: Chapter 9 AddNew but DNSless
> > Page 307
> >
> > <%
> > Dim oRS
> > Set oRS=Server.CreateObject("ADODB.Recordset")
> > oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
> > ...
> > %>
> >
> >
> > how would this line look if this was a DNSless connection ????
> >
> > I am assuming this is all I would have to change to make this work for a
> > DNSless connection.
> >
> > Thanks
>
> I maybe answering my own question but I'm wondering if this is correct
> <%
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.Open Session( ... DNSless connection ...)
>
> Dim oRS
> Set oRS=Server.CreateObject("ADODB.Recordset")
> oRS.Open "people", conn, adOpenKeyset, adLockOptimistic
> ' Insert a record
> oRS.AddNew
> ...
> %>
Message #6 by "Ken Schaefer" <ken@a...> on Tue, 26 Jun 2001 11:40:41 +1000
|
|
Huh?
Your first bit of code used a DSN - you are telling the recordset object to
open an implicit connection object for you, using the DSN to open the
connection. The DSN stores the necessary connection parameters (driver name,
database name) in the registry, and ADO looks it up at runtime. Both the
following bits of code are largely the same (the first is preferable):
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=Test"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "table", objConn,,,adCmdTable
%>
-vs-
<%
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "table", "DSN=Test",,,adCmdTable
%>
When you use a DSN-less connection you need to specify all the connection
params yourself, eg the driver name. Hence, you need to look at the page I
listed, and find the necessary DSN-less connection string.
Whether you specify this as a variable which you then supply to an
objConn.Open, or a objRS.Open is really irrelevant for the purposes of this
point (creating objConn explicitly though is important, for pooling
reasons).
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <mdehnel@a...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Monday, June 25, 2001 6:53 PM
Subject: [asp_database_setup] Re: Chapter 9 AddNew but DNSless
: > Page 307
: >
: > <%
: > Dim oRS
: > Set oRS=Server.CreateObject("ADODB.Recordset")
: > oRS.Open "people", "DNS=Sailors", adOpenKeyset, adLockOptimistic
: > ...
: > %>
: >
: >
: > how would this line look if this was a DNSless connection ????
: >
: > I am assuming this is all I would have to change to make this work for a
: > DNSless connection.
: >
: > Thanks
:
: I maybe answering my own question but I'm wondering if this is correct
: <%
: Set conn = Server.CreateObject("ADODB.Connection")
: conn.Open Session( ... DNSless connection ...)
:
: Dim oRS
: Set oRS=Server.CreateObject("ADODB.Recordset")
: oRS.Open "people", conn, adOpenKeyset, adLockOptimistic
: ' Insert a record
: oRS.AddNew
: ...
: %>
: ---
: STAY UP TO DATE ON ASP.NET, C#, VB.NET, SQL and XML
: Developersdex indexes over 100 of the top ASP, SQL, VB
: and XML sites bringing in more than 5,000 new resources
: every day. They even integrate all the top .NET
: newsgroups so you can search/post/reply across
: multiple newsgroups within their site. The next time
: you want to find an answer on ASP, C#, SQL, VB or XML
: think of Devdex! http://www.developersdex.com/
ken@a...
$subst('Email.Unsub')
|
|
 |