
October 19th, 2004, 03:36 PM
|
|
Contributing User
|
|
Join Date: Oct 2003
Posts: 100
Time spent in forums: 8 h 1 m 32 sec
Reputation Power: 5
|
|
|
Can't connect to DB using ASP
I am trying to connect to a SQL Server 2000 database using VBScript on an active server page, but I can't connect. I think my SQL Server may be set up wrong in the security settings.
I have my authenication set to Windows Authenication Only, and I have an "sa" account with a password.
Here is my code:
Code:
<%
dim objConn
dim sqlCmd
dim FromWebPage as string
FromWebPage = "FromWebPage"
'create connection
objConn = Server.CreateObject("ADODB.Connection")
'connect to the SQL Server db (local machine)
objConn.ConnectionString = "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=(local);DATABASE=SteelBoard;UID=sa;PWD=password;"
objConn.Open
sqlCmd = "insert into TestTable (FirstName) values ('" & FromWebPage & "')"
'put data into database
objConn.Execute(sqlCmd)
'close the connection
objConn.Close
objConn = nothing
%>
|