TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gerade Geldenhuys
NA
16
9.7k
Insert Into MySql Table
Mar 27 2012 9:19 AM
Im sorry if you have seen this question a thousand times, But ive googled this and still couldnt find a solution. I googled and changed my code a bit but it still doesnt fix my code.
So,i want insert data into my Mysql table But it kept giving me errors, the lastest of which is
"Only MySqlParamaters objects may be stored",
Here is my Code:
MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySql"].ConnectionString);
string com = "INSERT INTO Users(Name, Surname, Pass, Email, Type)
VALUES(@Name,@Surname,@Password,@Emailaddr, @type)";
MySqlCommand Com = new MySqlCommand(com, con);
Com.CommandType = CommandType.Text;
Com.Parameters.Add(new MySqlParameter("?Name", MySqlDbType.Text).Value = txtfname.Text);
Com.Parameters.Add(new MySqlParameter("?Surname", MySqlDbType.Text).Value = txtlname.Text);
Com.Parameters.Add(new MySqlParameter("?Password", MySqlDbType.Text).Value = txtpass11.Text);
Com.Parameters.Add(new MySqlParameter("?Emailaddr", MySqlDbType.Text).Value = txtemail.Text);
Com.Parameters.Add(new MySqlParameter("?type", MySqlDbType.Text).Value = "Patient");
con.Open();
Com.ExecuteNonQuery();
con.Close();
Reply
Answers (
1
)
Query
How to build a SQL database(bank) like microsoft Access Bank