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 from an asp.net page 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)";
First: I do believe you have a matter due to the use of the "@" parameter that mySql does not like.
In any case, you should be consistent with yourself : you used "?" in the parameters, and you should use it also in the query, like in the following example:
Third (less important, this is to make your life better, you can completely disregard the following)
c# is case sensitive, thus you might have a variable named "com" foro the commandString and a variable named "Com" for the Command Object. But let me suggest you to name one of the two in a different way
Last edited by Cimperiali; March 27th, 2012 at 09:36 AM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Bookmarks