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

SQL Server > Dreamweaver Connection Problem.Help!

Status
Not open for further replies.

VitoCorleone

Programmer
Jun 22, 2004
28
GB
Hi everyone,

---Im using SQL Server with which I have SQL authentication, so a user name and password.

---I create an ODBC Connection to my server and use SQL authentication radio box with my corrisponding username and password at the bottom.

---I link to my prefered database and test and it works.

---In Dreamweaver mx 2004 i create a DSN connection to the ODBC I created and use the same username and password.

NOW... Once I have done all that I can see all the tables in that database I'm linked to. I can create Recordsets etc..

THEN.... I make a simple page to check if its working, so i just add a RS to display infomation from a selected table.

BUT.... I get a HTTP 500 - Internal server error, Internet Explorer .

Why, Why? I have tried my hardest to figure out why it doent connect but fail. I can connect Via Hand code but not Via dreamweaver.

Here is my hand code if it helps. (not the code dreamweaver creates)

And also the code created by Dreamweaver.

HANDCODED CODE THAT WORKS

<%'@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


<%

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "bid_database","reddirob","sqlcon22"

%>


<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 5.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>

<%
sql_test = "SELECT name, userid, pw, status FROM dbo.gsf_passwords"

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql_test, conn, 3, 3
%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="33%">Name</td>
<td width="33%">User ID </td>
<td width="34%">Password</td>
<td width="34%">Status</td>
</tr>
<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>
<tr>
<td width="33%"><%=rs.Fields("name")%>&nbsp;</td>
<td width="33%"><%=rs.Fields("userid")%>&nbsp;</td>
<td width="34%"><%=rs.Fields("pw")%>&nbsp;</td>
<td width="34%"><%=rs.Fields("status")%></td>
<%
rs.MoveNext
loop%>
</tr>
</table>
<br>



</body>

</html>

DREAMWEAVER CODE NOT WORKING

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/sql_server.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_sql_server_STRING
Recordset1.Source = "SELECT * FROM dbo.gsf_passwords"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<%=(Recordset1.Fields.Item("name").Value)%></body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
 
Go to Enterprise Manager, right click on the database, select Properties, go to the Options tab.

Is Auto-Close checked? If so, uncheck it.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top