Hi,
I playing around with the .net connector, a mysql server and asp.net.
The structure of my test table is
index int(11) (Unique and auto_increment)
path varchar(200)
count int(11)
I want to query this table and select an entry with a specific index.
My code:
mySQLConnection.Open();
MySqlCommand command = new MySqlCommand("SELECT path FROM info WHERE index = ?id");
command.Connection = mySQLConnection;
command.Prepare();
command.Parameters.AddWithValue("?id", id);
string result = command.ExecuteScalar().ToString();
And all I get is:
MySql.Data.MySqlClient.MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index=1' at line 1
at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00000]
at MySql.Data.MySqlClient.NativeDriver.GetResult (System.Int32& affectedRow, System.Int32& insertedId) [0x00000]
What am I doing wrong?
I playing around with the .net connector, a mysql server and asp.net.
The structure of my test table is
index int(11) (Unique and auto_increment)
path varchar(200)
count int(11)
I want to query this table and select an entry with a specific index.
My code:
mySQLConnection.Open();
MySqlCommand command = new MySqlCommand("SELECT path FROM info WHERE index = ?id");
command.Connection = mySQLConnection;
command.Prepare();
command.Parameters.AddWithValue("?id", id);
string result = command.ExecuteScalar().ToString();
And all I get is:
MySql.Data.MySqlClient.MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index=1' at line 1
at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00000]
at MySql.Data.MySqlClient.NativeDriver.GetResult (System.Int32& affectedRow, System.Int32& insertedId) [0x00000]
What am I doing wrong?