AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Mon Jul 14, 2008 11:30 am Post subject: C# ASP.NET and Mysql help plz |
|
|
ive been trying to get a code to work, but it wont. originally, i used MSSQL as the database, but the hoster i want to use only supports MySql... so ive been trying to connect to mysql, and going of the register function. i cant get it to work. this is part of the register function. im not that great with C#, and i find connecting to MySql in C++ much easier..., but i cant.
TextBox FirstName = CreateUserWizardStep1.Controls[0].FindControl("FirstName") as TextBox;
TextBox LastName = CreateUserWizardStep1.Controls[0].FindControl("LastName") as TextBox;
string strProvider = "Network Address=localhost;Port = 3306;Database=eztp;User ID=root;Password=root";
MySqlConnection mysqlCon = new MySqlConnection(strProvider);
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand();
mysqlCon.Open();
string firstname = FirstName.Text;
string lastname = LastName.Text;
string userName = CreateUserWizardControl.UserName;
string email = CreateUserWizardControl.Email;
string pw = CreateUserWizardControl.Password;
string question = CreateUserWizardControl.Question;
string answer = CreateUserWizardControl.Answer;
string sqlString = "INSERT INTO user (Username,Firstname,Lastname,Email,Password,Question,Answer) VALUES (userName,0,0,email,pw,question,answer)";
cmd.CommandText = sqlString;
|
|