|
| |
|
|
Charlesb
Posts: 42 From: Fort Collins CO USA Status: offline
|
ASP & Connection to MS SQL database - 5/17/2004 17:37:12
Hello, I am trying to create a dsnless connection to Microsoft SQL server on a different subnet that does not use the default SQL port. If a copy my code to the same subnet that the SQL server is on - the code works just fine. But if it's running on the other subnet (which is where my web server is located) I get the following error msg: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. I have tried using the ip address of the sql server and the fully qualified name in the connection string with no success. My connection string - strConnect = "DRIVER={SQL Server}; Server=servername\sqlInstance; UID=username; PWD=password; Languages=us_english;Database=DatabaseName" I would have assumed that I would need to specify the port in the connection string - but I haven't found the syntax for doing that and the code works just fine when it is on same subnet as the sql server. Thank you, Charley
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: ASP & Connection to MS SQL database - 5/17/2004 23:09:21
Have you tried OLEDB? Something like: <% set cnn = server.createobject("ADODB.Connection") cnn.open "PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename " %>
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Charlesb
Posts: 42 From: Fort Collins CO USA Status: offline
|
RE: ASP & Connection to MS SQL database - 5/18/2004 15:24:51
thank you both for the suggestions - but no luck Using oledb I get: Microsoft OLE DB Provider for SQL Server error '80004005' [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Using sqlserverip address I get Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. Any other suggestions? Thank you, Charley
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: ASP & Connection to MS SQL database - 5/18/2004 15:27:32
Have you read this MS article? http://support.microsoft.com/?kbid=328306
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Charlesb
Posts: 42 From: Fort Collins CO USA Status: offline
|
RE: ASP & Connection to MS SQL database - 5/18/2004 19:27:17
I hadn't seen it. I had done a search on my error msg - must have missed it somehow. The information in it got me going down the right track - I had messed up some settings in the sql client network utility. All is working now. Thank you very much. Charley
|
|
|
|
phaithow
Posts: 11 Joined: 10/7/2004 Status: offline
|
RE: ASP & Connection to MS SQL database - 10/7/2004 4:10:58
I'm also face this problem. Here is my HTML Code. Could you please advise me on the mistake point? <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <% DIM conntemp, mySQL, myDSN 'myDSN = " DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath(" fpdb/spooky_login2000.mdb" ) 'myDSN would be specific to your environment 'myDSN = "DRIVER={SQL Server}; Server=Webserver\sqlInstance; UID=sa; PWD=kui9213; Languages=us_english;Database=Dhnarath2" myDSN = "PROVIDER=SQLOLEDB;DATA SOURCE=192.168.123.111;UID=sa;PWD=kui9213;DATABASE=Dhnarath2" set conntemp= server.createobject("adodb.connection" ) conntemp.open myDSN FOR i = 1 to 11 IF Request("rate" & i) > "" THEN mySQL = " INSERT INTO PO (PO_ID, Product_ID, Quantity,Unit,SP,Invoice_Number) VALUES" mySQL = mySQL & " (" & Request("PO_ID") & ", '" & Request("Product" & i) & "','" & Request("Quantity" & i) & "','" & Request("Unit" & i) & "'," & Request("SP" & i) & ", " & Request("Invoice_Number" & i) " Response.write(mySQL) conntemp.execute(mySQL) END IF NEXT conntemp.close set conntemp=nothing %> </body> </html> <html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<% DIM conntemp, mySQL, myDSN
'myDSN = " DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath(" fpdb/spooky_login2000.mdb" )
'myDSN would be specific to your environment
'myDSN = "DRIVER={SQL Server}; Server=Webserver\sqlInstance; UID=sa; PWD=kui9213; Languages=us_english;Database=Dhnarath2"
myDSN = "PROVIDER=SQLOLEDB;DATA SOURCE=192.168.123.111;UID=sa;PWD=kui9213;DATABASE=Dhnarath2"
set conntemp= server.createobject("adodb.connection" )
conntemp.open myDSN
FOR i = 1 to 11
IF Request("rate" & i) > "" THEN
mySQL = " INSERT INTO PO (PO_ID, Product_ID, Quantity,Unit,SP,Invoice_Number) VALUES"
mySQL = mySQL & " (" & Request("PO_ID") & ", '" & Request("Product" & i) & "','" & Request("Quantity" & i) & "','" & Request("Unit" & i) & "'," & Request("SP" & i) & ", " & Request("Invoice_Number" & i) "
Response.write(mySQL)
conntemp.execute(mySQL)
END IF
NEXT
conntemp.close
set conntemp=nothing
%>
</body>
</html>
|
|
|
|
rdouglass
Posts: 9202 From: Biddeford, ME USA Status: offline
|
RE: ASP & Connection to MS SQL database - 10/7/2004 8:19:08
quote:
,'" & Request("Quantity" & i) & "', Is Quantity a number field in the DB? Then remove the apostrophes like: ," & Request("Quantity" & i) & ", At least thats one thing I see.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|