![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 139
Rep Power: 4
![]() |
I installed the MySql driver, and was able to insert into the database just fine from my code behind file, but when i try to use the MySqlDataReader,, i get an error that it cannot be found:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
public partial class _Default : System.Web.UI.Page
{
MySqlConnection mysqlcon;
protected void Page_Load(object sender, EventArgs e)
{
Application["auth"] = false;
String con = "";
con = "server=localhost; user id=root; password=test; database=cs;";
mysqlcon = new MySqlConnection(con);
mysqlcon.Open();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
protected void login_Click(object sender, EventArgs e)
{
string formPassword = Request.Form["password"];
string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(formPassword, "sha1");
string dbPassword = "";
string dbUser = "";
MySqlCommand cmd = mysqlcon.CreateCommand();
MySqlDataReader recordset = mysqlcon.ExecuteReader();
cmd.CommandText = "SELECT userid, password from auth where password = '" + hashedPassword + "'";
recordset = cmd.EndExecuteReader();
while (recordset.Read())
{
dbUser = recordset.GetString(0);
dbPassword = recordset.GetString(1);
}
if (Request.Form["userid"] == dbUser && hashedPassword == dbPassword)
{
Application["auth"]=true;
Response.Redirect("enterInv.aspx");
}
}
}The errors say: Error 1 'MySql.Data.MySqlClient.MySqlConnection' does not contain a definition for 'ExecuteReader' C:\Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\ASP\final_assignment\Default.aspx.cs 44 46 C:\...\final_assignment\ Error 2 No overload for method 'EndExecuteReader' takes '0' arguments C:\Documents and Settings\Paul\My Documents\Visual Studio 2005\Projects\ASP\final_assignment\Default.aspx.cs 48 21 C:\...\final_assignment\ |
|
|
|
|
|
#2 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
Did you get this error worked out?
__________________
People who click "images" that end with .exe shouldn't have computers. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mysql asp.net | guess | ASP.NET | 1 | Mar 23rd, 2006 1:45 PM |
| Problem accessing MySQL database | MrMan9879 | PHP | 9 | Mar 23rd, 2006 8:47 AM |
| How to connect MySQL DataBase with ASP.NET | lucifer | C# | 2 | Mar 14th, 2006 7:09 PM |
| mySQL: Changing unique database to fulltext | BAS1X | PHP | 2 | Oct 24th, 2005 9:14 PM |
| Trying to write jsp files to MySql Database | reubenfields | Java | 1 | Apr 14th, 2005 9:51 AM |