|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP and SQL Server 2005 Express
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 sample connection strings are here
http://connectionstrings.com/ Show quote "Anil Gupte" <anil-l***@icinema.com> wrote in message news:On$YDZQKIHA.4712@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 > > Anil Gupte wrote:
Show quote > I am using the following to try to connect to the database, but it You really need to show us the error message, but i will say that I have had > 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") > 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" 0xE7D:The connection cannot be used to perform this operation. It is either
closed or invalid in this context. Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OG%230aZTKIHA.4880@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" > 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: Show quote > 0xE7D:The connection cannot be used to perform this operation. It is > either closed or invalid in this context. > > > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:OG%230aZTKIHA.4880@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" 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 Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:OG%230aZTKIHA.4880@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" > 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: Show quote > 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]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >>> news:OG%230aZTKIHA.4880@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" 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, Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OGufjCgKIHA.6008@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >>>> news:OG%230aZTKIHA.4880@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" > Did you ever get a resolution to this
http://www.webservertalk.com/archive126-2007-3-1848937.html? Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OGufjCgKIHA.6008@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >>>> news:OG%230aZTKIHA.4880@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" > 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. Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OGufjCgKIHA.6008@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >>>> news:OG%230aZTKIHA.4880@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" > Resolved - see answer to Zorlu
Thanx for your help. Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OGufjCgKIHA.6008@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:ejWqWnUKIHA.4752@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]" <reb01501@NOyahoo.SPAMcom> wrote in message >>>> news:OG%230aZTKIHA.4880@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" > I also have now tried creating a DSN called Media and using:
sConnString = "DSN=Media" Doesn't work. Show quote "Anil Gupte" <anil-l***@icinema.com> wrote in message news:On$YDZQKIHA.4712@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 > > This is not actually an ASP question.
Try posting your problem to the SQL server group here: microsoft.public.sqlserver.programming 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" it's a connection string problem
Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OAowEFhKIHA.2176@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" > 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, Show quote "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot com> wrote in message news:13k10b1p4u47a48@corp.supernews.com... > This is not actually an ASP question. > Try posting your problem to the SQL server group here: > > microsoft.public.sqlserver.programming > > 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\SQLEXPRESS;uid=USER;pwd=PASSWORD;database=DB;" set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Errors.Clear my_Conn.Open strConnString Anil Gupte wrote: Show quote > 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, 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 Show quote "M. Savas Zorlu" <sa***@zorlumail.com> wrote in message news:%23NP3QMoKIHA.3516@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\SQLEXPRESS;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,
Other interesting topics
|
|||||||||||||||||||||||