using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace Project1 { public partial class Register : Form { private MySqlConnection myCon = new MySqlConnection("server=MKHX112208;uid=ojt;pwd=Password1;database=ask_it"); private MySqlCommand myCom; public Register() { InitializeComponent(); } MySqlConnection con; MySqlCommand cmd; MySqlDataReader dr; private void btnRegister_Click(object sender, EventArgs e) { con.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = con; { cmd.CommandText = "INSERT INTO users (firstname, lastname, username, password, emailadd) VALUES(@firstname, @lastname, @username, @password, @emailadd)"; cmd.Parameters.AddWithValue("@firstname", txtFirstName.Text); cmd.Parameters.AddWithValue("@lastname", txtLastName.Text); cmd.Parameters.AddWithValue("@username", txtUserName.Text); cmd.Parameters.AddWithValue("@password", txtPassword.Text); cmd.Parameters.AddWithValue("@emailadd", txtEmailadd.Text); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Saving is done!"); } }
()
@
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)