Click to See Complete Forum and Search --> : Conecting an ASP with SQL Server


MarkGG
06-20-2005, 02:39 PM
Hello I have a website I am working on where the user submits entries and pulls queries from a SQL Server database using some ASPs. I am using VB within the ASP to perform this operaion but I cannot get it work...

This is the page that the user submits from:

<HTML>
<body bgcolor=#6699CC link="blue" vlink="blue" alink="blue">
<center><font size="4" color="black"><b>Add Records</b></font>
<hr width = 50% size =4>
<br>
<form name="ADD" action="Add2.asp" method="post">
<table border = "2" bgcolor="white">
<tr><td>Category of Entry: <select name="AddCategory">
<option value="Choose">Please choose an option...</option>
<option value="People">People</option>
<option value="Town">Town</option>
<option value="Facility">Facility</option></td></tr>
<tr><td>Name of Entry:<input type="text" size="40" name="Name" value="Please enter a name"/></td></tr>
<tr><td><center><input type="Submit" name = "Submit" value= "Submit"></td></center></tr>
</table>
</form>
</center>
</body>
</HTML>

and this is the page that it re-directs to (you can somewhat ignore the bottom HTML part that is for the next step)

<HTML>

<%
ON ERROR RESUME NEXT
Dim con,sql,constring
Set con = Server.CreateObject("ADODB.Connection")
%>

<!-- #include file="dbConnect.ssi" -->

<%
sql = "Insert into Main values(" & Request.Form("Name") & "," & Request.Form("AddCategory") & ")"
'I open my connection
con.Open constring
'I execcute
con.Execute(sql)
'I close my connection
con.Close
'I destroy my objects
Set con = Nothing
If Err.number = 0 Then
Response.Redirect("SomeAsp.asp")
Else
Response.Write "<P Align=Center><B>There was ab error. Pleas click <a href=somepage.asp>here</a> to continue</B></P>"
End If
%>



<body bgcolor=#6699CC link="blue" vlink="blue" alink="blue">
<center><font size="4" color="black"><b>Adding an entry: step 2</b></font></center>
<hr width = 50% size =4>
<br>
</center>
<table border = "2" bgcolor="white"><tr>
<td>Type:<input type="text" size="10" Name="Type" value=AddCategory disabled></td>
<td>Name:<input type="text" size="40" Name="Name" value=Name disabled ></td>
</table>
</body>
</HTML>

When I click submit I am getting the error:

"Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/TW/www/CCIS/Add2.asp, line 14"

-Mark

silverbullet24
06-20-2005, 05:50 PM
let's see the contents of dbConnect.ssi

MarkGG
06-21-2005, 08:32 AM
Sorry, I already got this page all sorted out and it works now :)

Thanks anyway

-Mark