G
Guest
Hello friends,
I have some problem in my ASP.NET connection
'Connection file code
<%
dim connstr
connstr=("Provider=Microsoft.Jet.OLEDB.4.0;data
source="&server.mappath("database/it.mdb")&"")
%>
follwoing error message occur when i execute the page
Compiler Error Message: BC30451: Name 'connstr' is not declared.
'Below is the file where i am using it
<!-- #include file="connection.aspx"-->
<script language="VB" runat="server">
Public Sub searchsh()
Response.Write ("<table align=center width=100% cellspacing=4 cellpadding=0
border=0><tr>")
Response.Write ("<td width=30% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0><tr>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif>")
Response.Write ("<b>NAME</b></font></td></tr></table></td>")
Response.Write ("<td width=30% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0><tr>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif>")
Response.Write ("<b>ADDRESS</b></font></td></tr></table></td>")
Response.Write ("<td width=15% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0>")
Response.Write ("<tr><td width=100% align=middle>")
Response.Write ("<font size=2 color=Azure face=Arial, Helvetica,
sans-serif><b>HELLO</b></font></td>")
Response.Write ("</tr></table></td>")
Response.Write ("<td width=15% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif><b>Email</b></font></td>")
Response.Write ("</table></td></tr>")
Dim sqlq="SELECT * from softhouse where cityID Like'"&Request.Form("city")&"'"
Dim objdatareader as new OLEDBDataReader
Dim cmdobj as new OLEDBCommand(sqlq,objconn)
'objDataReader=cmdobj.Executereader()
</script>
<%if Request.Form("searchchoice")=1 then
searchsh
end if
%>
I have some problem in my ASP.NET connection
'Connection file code
<%
dim connstr
connstr=("Provider=Microsoft.Jet.OLEDB.4.0;data
source="&server.mappath("database/it.mdb")&"")
%>
follwoing error message occur when i execute the page
Compiler Error Message: BC30451: Name 'connstr' is not declared.
'Below is the file where i am using it
<!-- #include file="connection.aspx"-->
<script language="VB" runat="server">
Public Sub searchsh()
Response.Write ("<table align=center width=100% cellspacing=4 cellpadding=0
border=0><tr>")
Response.Write ("<td width=30% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0><tr>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif>")
Response.Write ("<b>NAME</b></font></td></tr></table></td>")
Response.Write ("<td width=30% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0><tr>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif>")
Response.Write ("<b>ADDRESS</b></font></td></tr></table></td>")
Response.Write ("<td width=15% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0>")
Response.Write ("<tr><td width=100% align=middle>")
Response.Write ("<font size=2 color=Azure face=Arial, Helvetica,
sans-serif><b>HELLO</b></font></td>")
Response.Write ("</tr></table></td>")
Response.Write ("<td width=15% align=middle valign=top bgcolor=SaddleBrown>")
Response.Write ("<table align=center width=100% cellspacing=2 cellpadding=0
border=0>")
Response.Write ("<td width=100% align=middle><font size=2 color=Azure
face=Arial, Helvetica, sans-serif><b>Email</b></font></td>")
Response.Write ("</table></td></tr>")
Dim sqlq="SELECT * from softhouse where cityID Like'"&Request.Form("city")&"'"
Dim objdatareader as new OLEDBDataReader
Dim cmdobj as new OLEDBCommand(sqlq,objconn)
'objDataReader=cmdobj.Executereader()
</script>
<%if Request.Form("searchchoice")=1 then
searchsh
end if
%>