Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
I am getting error in connecting database sql server 2005 with asp.net, using Javascript.

My user id is= SYSTEM/user2, there is no password, server name is= SYSTEM/SQLEXPRESS, windows authentication and my database name is Test1,

Here is my code and it displays error at:
conn.open "DSN=Test1;uid=System\user2;password="";"
//code is
<%
            Dim conn
            Dim rs
            strConn = "Driver={SQL Server};Server=127.0.0.1;Database=Test1;Trusted_Conection=Yes;

            Set cnt =Server.CreateObject(ADODB.Connection)

            cnt.ConnectionString=DNS.Test1

            conn.open  DSN=Test1;uid=SYSTEM\user2;password="";

            strSQL = "select * from Test2"

            set rs = cnt.execute(strSQL)
            Do while not rs.eof

            response.Write "Name:" & rs(0)

            rs.movenext

            Loop
  %>

Can anybody try to solve my problem?
Posted
Updated 24-Feb-11 22:08pm
v2

You have a \ in your connection string which means you need to use an @ before you define the string.
 
Share this answer
 
If you've copied your code exactly as is then it will fail: presumably you've omitted some of the quotes. Anyway, assuming that the quotes are there try this:

conn.open "DSN=Test1;uid=System\user2;password=;"

In other words the extra quotes for password (which you don't need) should not be there.
 
Share this answer
 
Same error

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/UI/totalsql.asp,
line =
conn.open "DSN=Test1;uid=System\user2;password=;"



object required is for / than how to resolve it, and also on one machine the uid is system-user/user2, how to write it
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900