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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Connection Code

Status
Not open for further replies.

Braderd

Programmer
Mar 2, 2008
20
TR
Hi,

I have a maillist script. I was use this script in access database system. Some part of the code:

Uemail=lcase(request.form("email"))
subs=request.form("subs")
dsn="DBQ=" & Server.Mappath("../../database/subs.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
sql = "select * from emails where emails='"&Uemail&"'"
conn.open dsn
rs.open sql,conn
select case subs
'in case someOne wants to join the list
case "1"

Now , I changed my access db to ms sql 2005 db from DTS. I wrote new connectin code, maybe it is not correct.

strdsn.Open "driver={SQL Server};server=BORA\SQLEXPRESS;database=bora;Uid=bora1;Pwd=11111"

but i m receiving this error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/maillist/maillist.asp, line 39

What can i do? Thank you.
 
This page has all the connection string information.


What line of code is on line 39?

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
hi, thank you for your reply.
line 39:
strdsn.Open "driver={SQL Server};server=BORA\SQLEXPRESS;database=bora;Uid=bora1;Pwd=11111
 
I'm not a VBScript expert, and maybe I'm stating the obvious, but it seems that it is saying the object strdsn was not successfully created in a previous step.

--------------
 
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/maillist/maillist.asp, line 42

Line 37-42;

subs=request.form("subs")
dsn="DBQ=" & "driver={SQL Server};Server=cccc\SQLEXPRESS;Database=subs;Uid=subs1;Pwd=myPassword;"
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
sql = "select * from emails where emails='"&Uemail&"'"
Line 42 = conn.open dsn
rs.open sql,conn
select case subs

Maybe i wrote not correct line 38;
dsn="DBQ=" & "driver={SQL Server};Server=cccc\SQLEXPRESS;Database=subs;Uid=subs1;Pwd=myPassword;"
thank you your reply.
 
try this...

dsn = "Provider=SQLNCLI;Server=cccc\SQLEXPRESS;Database=subs;Uid=subs1;Pwd=myPassword;"



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
thank you for your code, it is working
but now i m receiving this error:

Microsoft OLE DB Provider for SQL Server error '80040e09'

The SELECT permission was denied on the object 'emails', database 'subs', schema 'dbo'.

/maillist/maillist.asp, line 43

line 43:
rs.open sql,conn

thank you.
 
Someone needs to grant the account subs1 SELECT access to the emails table.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top