472,368 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,368 software developers and data experts.

ASP and SQL Server 2005 Express

I am using the following to try to connect to the database, but it does not
seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=MediaDB;Data Source=MEDIAMACHINE\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which worked)
for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")

TIA
--
Anil Gupte
www.keeninc.net
www.icinema.com
Nov 17 '07 #1
17 2556
sample connection strings are here

http://connectionstrings.com/

"Anil Gupte" <an*******@icinema.comwrote in message news:On**************@TK2MSFTNGP04.phx.gbl...
>I am using the following to try to connect to the database, but it does not seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("/Music/DB/MediaDB.mdb")

TIA
--
Anil Gupte
www.keeninc.net
www.icinema.com


Nov 17 '07 #2
Anil Gupte wrote:
I am using the following to try to connect to the database, but it
does not seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which
worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")
You really need to show us the error message, but i will say that I have had
little success connecting to SQL2005 with integrated security from ASP. I
would suggest creating a sql login on your server and using its user id and
password in your connection string instead of Integrated Security=SSPI

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 17 '07 #3
0xE7D:The connection cannot be used to perform this operation. It is either
closed or invalid in this context.

--
Anil Gupte
www.keeninc.net
www.icinema.com

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl...
Anil Gupte wrote:
>I am using the following to try to connect to the database, but it
does not seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which
worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")
You really need to show us the error message, but i will say that I have
had little success connecting to SQL2005 with integrated security from
ASP. I would suggest creating a sql login on your server and using its
user id and password in your connection string instead of Integrated
Security=SSPI

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 17 '07 #4
So the "Connection.Open sConnString" statement didn't raise an error? I
don't see any code in which you tried to use the connection object. Neither
do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl...
>Anil Gupte wrote:
>>I am using the following to try to connect to the database, but it
does not seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which
worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 17 '07 #5
Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=iMedia;Data Source=IMEDIA/SQLEXPRESS"
' Tried both the above and the below - no luck
sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new object
Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
So the "Connection.Open sConnString" statement didn't raise an error? I
don't see any code in which you tried to use the connection object.
Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
>0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl...
>>Anil Gupte wrote:
I am using the following to try to connect to the database, but it
does not seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which
worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0 ;" & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")

You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 18 '07 #6
I also have now tried creating a DSN called Media and using:
sConnString = "DSN=Media"

Doesn't work.

--
Anil Gupte
www.keeninc.net
www.icinema.com

"Anil Gupte" <an*******@icinema.comwrote in message
news:On**************@TK2MSFTNGP04.phx.gbl...
>I am using the following to try to connect to the database, but it does not
seem to be working.

Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")

Can someone tell me the correct syntax? The original syntax (which
worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")

TIA
--
Anil Gupte
www.keeninc.net
www.icinema.com


Nov 18 '07 #7
You still have yet to show us the line that produces that error. If the
Connection.Open statement does not throw an error, then there is nothing
wrong with your connection string. I do not blieve the Connection.Open
statement can throw that particular error ... wait ... "Connection" may be a
reserved keyword. Try calling your connection object "cn" or "conn" or
something like that.

The only other possibility is that the Connection.Open statement actually IS
throwing an error, but you have an "on error resume next" statement earlier
in your code that is masking te error. Make sure you comment out that
statement so you can see if the Open statement produces an error. If it
does, show us THAT error message.

Anil Gupte wrote:
Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=iMedia;Data
Source=IMEDIA/SQLEXPRESS" ' Tried both the above and the below - no
luck sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new
object Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
>So the "Connection.Open sConnString" statement didn't raise an
error? I don't see any code in which you tried to use the connection
object. Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
>>0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl.. .
Anil Gupte wrote:
I am using the following to try to connect to the database, but it
does not seem to be working.
>
Dim sConnString
sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MediaDB;Data
Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
Dim Recordset
Set Recordset=Server.CreateObject("ADODB.Recordset")
>
Can someone tell me the correct syntax? The original syntax
(which worked) for an Access DB was as follows:
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" &
Server.MapPath("/Music/DB/MediaDB.mdb")
>
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap
so I don't check it very often. If you must reply off-line, then
remove the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 18 '07 #8
This is not actually an ASP question.
Try posting your problem to the SQL server group here:

microsoft.public.sqlserver.programming
Nov 18 '07 #9
Jon Paal [MSMD] wrote:
This is not actually an ASP question.
I'm not sure what makes you say that? I mean, he hasn't exactly shown us
enough to make that determination yet, at least IMHO.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Nov 18 '07 #10
Bob:

Sorry, you are right, I had the "On Error Resume Next", which I have now
commented out. Here are the various error messages - I am printing the
connection string at the top of each page.
*****************************
Provider=SQLOLEDB;Integrated Security=True;Initial Catalog=MEDIA;Data
Source=.\SQLEXPRESS
Provider error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status
value, if available. No work was done.
*****************************
DSN=Media
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "iMedia"
requested by the login. The login failed.
*****************************
Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=iMedia;Data Source=MEDIA/SQLEXPRESS
Microsoft SQL Native Client error '80004005'
Named Pipes Provider: Could not open a connection to SQL Server [51].
*****************************
BTW, with the DSN above I tried both Windows Authentication and SQL User
Authentication. I also did the "Test Data Source" in both instances and it
works. I know it is some syntax problem because I am using this last
connection string succesfully with ASP.Net/C# and a VB.Net service both of
which I wrote and are on the same machine/same website.
All help is appreciated. Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
You still have yet to show us the line that produces that error. If the
Connection.Open statement does not throw an error, then there is nothing
wrong with your connection string. I do not blieve the Connection.Open
statement can throw that particular error ... wait ... "Connection" may be
a reserved keyword. Try calling your connection object "cn" or "conn" or
something like that.

The only other possibility is that the Connection.Open statement actually
IS throwing an error, but you have an "on error resume next" statement
earlier in your code that is masking te error. Make sure you comment out
that statement so you can see if the Open statement produces an error. If
it does, show us THAT error message.

Anil Gupte wrote:
>Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=iMedia;Data
Source=IMEDIA/SQLEXPRESS" ' Tried both the above and the below - no
luck sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new
object Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
>>So the "Connection.Open sConnString" statement didn't raise an
error? I don't see any code in which you tried to use the connection
object. Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl. ..
Anil Gupte wrote:
>I am using the following to try to connect to the database, but it
>does not seem to be working.
>>
>Dim sConnString
>sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
>Security Info=False;Initial Catalog=MediaDB;Data
>Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
>Dim Recordset
>Set Recordset=Server.CreateObject("ADODB.Recordset")
>>
>Can someone tell me the correct syntax? The original syntax
>(which worked) for an Access DB was as follows:
>sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0 ;" & "Data Source=" &
>Server.MapPath("/Music/DB/MediaDB.mdb")
>>
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap
so I don't check it very often. If you must reply off-line, then
remove the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 19 '07 #11
Did you ever get a resolution to this
http://www.webservertalk.com/archive...-1848937.html?

--
Anil Gupte
www.keeninc.net
www.icinema.com

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
You still have yet to show us the line that produces that error. If the
Connection.Open statement does not throw an error, then there is nothing
wrong with your connection string. I do not blieve the Connection.Open
statement can throw that particular error ... wait ... "Connection" may be
a reserved keyword. Try calling your connection object "cn" or "conn" or
something like that.

The only other possibility is that the Connection.Open statement actually
IS throwing an error, but you have an "on error resume next" statement
earlier in your code that is masking te error. Make sure you comment out
that statement so you can see if the Open statement produces an error. If
it does, show us THAT error message.

Anil Gupte wrote:
>Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=iMedia;Data
Source=IMEDIA/SQLEXPRESS" ' Tried both the above and the below - no
luck sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new
object Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
>>So the "Connection.Open sConnString" statement didn't raise an
error? I don't see any code in which you tried to use the connection
object. Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl. ..
Anil Gupte wrote:
>I am using the following to try to connect to the database, but it
>does not seem to be working.
>>
>Dim sConnString
>sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
>Security Info=False;Initial Catalog=MediaDB;Data
>Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
>Dim Recordset
>Set Recordset=Server.CreateObject("ADODB.Recordset")
>>
>Can someone tell me the correct syntax? The original syntax
>(which worked) for an Access DB was as follows:
>sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0 ;" & "Data Source=" &
>Server.MapPath("/Music/DB/MediaDB.mdb")
>>
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap
so I don't check it very often. If you must reply off-line, then
remove the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 19 '07 #12
I believe it is an ASP question because I can connect fine in other
languages including C#/ASP.Net and VB.Net It is only in ASP that the
connection strings are not working, so there must be a syntax issue.

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot comwrote in message
news:13*************@corp.supernews.com...
This is not actually an ASP question.
Try posting your problem to the SQL server group here:

microsoft.public.sqlserver.programming


Nov 19 '07 #13
Here is another:

Provider=SQLOLEDB;Data Source=.\SQLEXPRESS;Initial Catalog=Media;User
id=sa;Password=Abc
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.

I also tried
Provider=SQLNCLI.1;Data Source=.\SQLEXPRESS;Initial Catalog=Media;User
id=sa;Password=Abc

Same error.

--
Anil Gupte
www.keeninc.net
www.icinema.com
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
You still have yet to show us the line that produces that error. If the
Connection.Open statement does not throw an error, then there is nothing
wrong with your connection string. I do not blieve the Connection.Open
statement can throw that particular error ... wait ... "Connection" may be
a reserved keyword. Try calling your connection object "cn" or "conn" or
something like that.

The only other possibility is that the Connection.Open statement actually
IS throwing an error, but you have an "on error resume next" statement
earlier in your code that is masking te error. Make sure you comment out
that statement so you can see if the Open statement produces an error. If
it does, show us THAT error message.

Anil Gupte wrote:
>Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=iMedia;Data
Source=IMEDIA/SQLEXPRESS" ' Tried both the above and the below - no
luck sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new
object Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
>>So the "Connection.Open sConnString" statement didn't raise an
error? I don't see any code in which you tried to use the connection
object. Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl. ..
Anil Gupte wrote:
>I am using the following to try to connect to the database, but it
>does not seem to be working.
>>
>Dim sConnString
>sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
>Security Info=False;Initial Catalog=MediaDB;Data
>Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
>Dim Recordset
>Set Recordset=Server.CreateObject("ADODB.Recordset")
>>
>Can someone tell me the correct syntax? The original syntax
>(which worked) for an Access DB was as follows:
>sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0 ;" & "Data Source=" &
>Server.MapPath("/Music/DB/MediaDB.mdb")
>>
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap
so I don't check it very often. If you must reply off-line, then
remove the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 19 '07 #14
I have recently upsized my access db to MSSQL too and here is the
connection string I use and it is working fine. Might help:

strConnString="provider=sqloledb;server=SE\SQLEXPR ESS;uid=USER;pwd=PASSWORD;database=DB;"

set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Errors.Clear

my_Conn.Open strConnString

Anil Gupte wrote:
I believe it is an ASP question because I can connect fine in other
languages including C#/ASP.Net and VB.Net It is only in ASP that the
connection strings are not working, so there must be a syntax issue.

Thanx,
Nov 19 '07 #15
Resolved - see answer to Zorlu

Thanx for your help.
--
Anil Gupte
www.keeninc.net
www.icinema.com

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
You still have yet to show us the line that produces that error. If the
Connection.Open statement does not throw an error, then there is nothing
wrong with your connection string. I do not blieve the Connection.Open
statement can throw that particular error ... wait ... "Connection" may be
a reserved keyword. Try calling your connection object "cn" or "conn" or
something like that.

The only other possibility is that the Connection.Open statement actually
IS throwing an error, but you have an "on error resume next" statement
earlier in your code that is masking te error. Make sure you comment out
that statement so you can see if the Open statement produces an error. If
it does, show us THAT error message.

Anil Gupte wrote:
>Yes, I have that earlier in the file
Dim Connection
Set Connection=Server.CreateObject("ADODB.Connection")

sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=iMedia;Data
Source=IMEDIA/SQLEXPRESS" ' Tried both the above and the below - no
luck sConnString = "Provider=SQLOLEDB;Integrated Security=True;Initial
Catalog=IMEDIA;Data Source=.\SQLEXPRESS"
Connection.Open sConnString
Dim Recordset 'Here we declare our variable that will hold our new
object Set Recordset=Server.CreateObject("ADODB.Recordset")

Thanx for your help

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:ej**************@TK2MSFTNGP05.phx.gbl...
>>So the "Connection.Open sConnString" statement didn't raise an
error? I don't see any code in which you tried to use the connection
object. Neither do I see a

Set Connection = Createobject("adodb.connection")

statement. Does one exist?

Anil Gupte wrote:
0xE7D:The connection cannot be used to perform this operation. It is
either closed or invalid in this context.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OG****************@TK2MSFTNGP03.phx.gbl. ..
Anil Gupte wrote:
>I am using the following to try to connect to the database, but it
>does not seem to be working.
>>
>Dim sConnString
>sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist
>Security Info=False;Initial Catalog=MediaDB;Data
>Source=MEDIAMACHINE\SQLEXPRESS" Connection.Open sConnString
>Dim Recordset
>Set Recordset=Server.CreateObject("ADODB.Recordset")
>>
>Can someone tell me the correct syntax? The original syntax
>(which worked) for an Access DB was as follows:
>sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0 ;" & "Data Source=" &
>Server.MapPath("/Music/DB/MediaDB.mdb")
>>
You really need to show us the error message, but i will say that I
have had little success connecting to SQL2005 with integrated
security from ASP. I would suggest creating a sql login on your
server and using its user id and password in your connection string
instead of Integrated Security=SSPI
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap
so I don't check it very often. If you must reply off-line, then
remove the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 19 '07 #16
Oh, Wow! This worked for me.

I also had one more mistake - I had changed the variable Connection to Conn
except in the
Recordset.Open SQL, Conn
statement

--
Anil Gupte
www.keeninc.net
www.icinema.com

"M. Savas Zorlu" <sa***@zorlumail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I have recently upsized my access db to MSSQL too and here is the
connection string I use and it is working fine. Might help:

strConnString="provider=sqloledb;server=SE\SQLEXPR ESS;uid=USER;pwd=PASSWORD;database=DB;"

set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Errors.Clear

my_Conn.Open strConnString

Anil Gupte wrote:
>I believe it is an ASP question because I can connect fine in other
languages including C#/ASP.Net and VB.Net It is only in ASP that the
connection strings are not working, so there must be a syntax issue.

Thanx,

Nov 19 '07 #17
it's a connection string problem
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message news:OA**************@TK2MSFTNGP06.phx.gbl...
Jon Paal [MSMD] wrote:
>This is not actually an ASP question.

I'm not sure what makes you say that? I mean, he hasn't exactly shown us enough to make that determination yet, at least IMHO.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Nov 19 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
If i've installed SQL Server 2005 Developer, when I come to install VS 2005 is there any need to install SQL Server Express? I would have thought the install would have detected SQL Server...
1
by: Darryl Kerkeslager | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp SQL Server Express was developed with two distinct uses in mind. The first is as a server product,...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
16
by: Jeremy S. | last post by:
I'm about to install VS.NET 2005 and SQL Server 2005 on a new/clean development machine (XP Pro/SP2 etc). Is the order of installation important (i.e., which product should I install first)? ...
10
by: amjad | last post by:
how to connection sql server table with aspx like pulling data from table to grid view.... simple example to start .... thanks
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
2
by: kress1963nov22 | last post by:
I recently purchased a good MS book ("Build a Web Site Now") by Jim Buyens. It has the Express Edition of MS-Visual Web Developer 2005 on CD and also MS SQL Server 2005 Express Edition on the CD. A...
3
by: leonaisse | last post by:
Hi I have a bunch on tables and data in my local SQL Server 2005 Express master DB and I want to export it to a database.mdf within my wwwroot (visual studio) file - how can i do this? Thanks...
3
by: Steve | last post by:
Hi All I downloaded Sql server 2005 express SP2 and attempted to modify the Bootstrapper package files as I did with SP1 When i try to install SQL server as part of my VS 2005 deployment app I...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.