T
trant
I have having difficulty figuring out how to insert into a MySql database
using C# and MySql Connector.
I looked over several tutorials now I I seem to have everything correct but
for some reason values never get inserted into my table, everything is NULL!
here is my code:
MySqlConnection connection = new MySqlConnection(MyConString);
connection.Open();
MySqlCommand command = new MySqlCommand("INSERT INTO mytable (name) VALUES
(@name)", connection);
command.Parameters["@name"].Value = "test";
command.ExecuteNonQuery();
It inserts a row into my table but everything is NULL.
If I run this same query right into a mysql console (substituting the
parameter of course_ it works fine.
What did I do wrong?
using C# and MySql Connector.
I looked over several tutorials now I I seem to have everything correct but
for some reason values never get inserted into my table, everything is NULL!
here is my code:
MySqlConnection connection = new MySqlConnection(MyConString);
connection.Open();
MySqlCommand command = new MySqlCommand("INSERT INTO mytable (name) VALUES
(@name)", connection);
command.Parameters["@name"].Value = "test";
command.ExecuteNonQuery();
It inserts a row into my table but everything is NULL.
If I run this same query right into a mysql console (substituting the
parameter of course_ it works fine.
What did I do wrong?