Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 6th, 2007, 7:25 PM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Exclamation critical: pls help: MySql Database with ASP.NET and C#

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\
paulchwd is offline   Reply With Quote
Old Apr 16th, 2007, 3:51 AM   #2
Ghost
Man Bear Pig Hunter
 
Ghost's Avatar
 
Join Date: Jul 2005
Location: NorCal, USA
Posts: 292
Rep Power: 4 Ghost is on a distinguished road
Did you get this error worked out?
__________________
People who click "images" that end with .exe shouldn't have computers.
Ghost is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:37 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC