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

How to specify certain name of the data from mysql database

Status
Not open for further replies.

Mentos123

Programmer
Feb 8, 2007
9
MY
Hi all,
really need your help. I am doing asp.net website(login page) using VB.net script. but i face some problem here. i can access mysql db, but the problem is that i would like to check whether the login id and pwd the user key in is valid or not..but when i click at the submit button, the error keep on coming out saying:No data exists for the row/column.
Below is my coding.. plssss.. can someone please help.. it is quite urgent..

<%@ Page Language="VB" AutoEventWireup="False" EnableSessionState="False" EnableViewState="False" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>

<%

IF request.querystring("step") = "2" THEN

Dim str_Username = Request.Form ("loginid")
Dim str_Password = Request.Form ("password")

Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=DBName;uid=root;pwd=password;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)
Dim cmd As OdbcCommand = New OdbcCommand("SELECT * FROM login WHERE sLoginID = '" & str_Username & "' AND sPassword = '" & str_Password & "'", con)
con.Open()

Dim rsrecord As OdbcDataReader = cmd.ExecuteReader()


If (rsrecord("sType"))="exp" Then 'This is the error part
Response.Redirect("Export.aspx")
ElseIf (rsrecord("sType"))="imp" Then
Response.Redirect("import.aspx")
Else
Response.Write("<script language='JavaScript'>alert('Invalid Login ID or Password!!!');</script>")
End If
cmd.ExecuteNonQuery()
con.Close()

End If



%>


<html>
<head>
<title>Login validation</title>
</head>

<body>
<form action="Login.aspx?step=2" method="post" name="myForm">
<table width="40%" border="0" align="center">
<tr>
<td width="35%" bordercolor="#FFFFFF"> <div align="left"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-serif">Login ID: </font></div></td>
<td width="8%" bordercolor="#FFFFFF"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-serif">:</font></td>
<td width="46%" bordercolor="#FFFFFF"> <input type="text" name="loginid" maxlength="20" size="20" class="texbox">
</td>
</tr>
<tr>
<td colspan="3" bordercolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="35%" bordercolor="#FFFFFF"><div align="left"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-serif">Password:</font></div></td>
<td width="8%" bordercolor="#FFFFFF"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-serif">:</font></td>
<td width="46%" bordercolor="#FFFFFF"> <input type="password" name="password" size="20" maxlength="20" class="texbox"></td>
</tr>
<tr>
<td colspan="3" bordercolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td colspan="5" align="center" bordercolor="#FFFFFF"><input type="submit" name="Submit" value="Login" class="button"><input type="reset" name="Reset" value="Reset" class="button">

</td>
</tr>

</table>
</form>


</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top