Hello,
I am in a horrible bind. I convinced my friend to change webhost companies. he has a script that used to work on his old webserver, but not it does not because it uses a DSN connection opposed to a direct connection. I have tried to figure this out and have no luck. I have an example of the new website dsn connection and my friends old script (by the way I contacted the new webiste support and they told me to use the script)
example that the new website gives out
Here is the old code
Any help is greatly appreciated it.
thank you!!
I am in a horrible bind. I convinced my friend to change webhost companies. he has a script that used to work on his old webserver, but not it does not because it uses a DSN connection opposed to a direct connection. I have tried to figure this out and have no luck. I have an example of the new website dsn connection and my friends old script (by the way I contacted the new webiste support and they told me to use the script)
example that the new website gives out
Code:
<%
Dim oConn, oRs
Dim qry, connectstr, sDSNDir
Dim db_name, db_username, db_userpassword
Dim db_server, dsn_name
dsn_name = "access_menu"
fieldname = "item"
tablename = "menu"
sDSNDir = Server.MapPath("_dsn")
connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename
Set oRS = oConn.Execute(qry)
if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & " "
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing
%>
Here is the old code
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_access_menu_STRING
MM_access_menu_STRING = "dsn=access_menu;uid=myuserid;pwd=mypassword;"
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_access_menu_STRING
Recordset1.Source = "SELECT * FROM menu"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
#Layer1 {
position:absolute;
left:13px;
top:21px;
width:744px;
height:22px;
z-index:1;
}
.style2 {font-size: 24px; font-weight: bold; }
#Layer2 {
position:absolute;
left:14px;
top:158px;
width:746px;
height:90px;
z-index:2;
}
-->
</style>
</head>
<body>
<div id="Layer1">
<div align="center" class="style2">Apetizers</div>
</div>
<blockquote>
<blockquote>
<blockquote>
<p> </p>
</blockquote>
</blockquote>
</blockquote>
<table width="750" border="0">
<tr>
<td width="573" height="31"> </td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
<tr>
<td height="29"><div align="center"><span class="style1"><%=(Recordset1.Fields.Item("item").Value)%> <%=(Recordset1.Fields.Item("price").Value)%></span></div></td>
</tr>
<tr>
<td><div align="center"><%=(Recordset1.Fields.Item("description").Value)%></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<p> </p>
</body>
</html>
<%
Recordset1.Close()
Set Rec
Any help is greatly appreciated it.
thank you!!