I am using C# in visual studio, trying to insert data into a column in MySql 5. I want to take the value of ampm which is am, and put it into my column ampm in my database called teleyapper.
I can connect to the data with visual studio's odbc data set and insert and retrieve the data. I can go into the mysql querey browser and insert and retrieve the data. But for the life of me, I can't find the right syntax to insert and retieve data in my C# code. The latest syntax attempts are below. I don't catch an exception.
in addition, ampm is a string in my code, but ampm column is varchar(2).
I'd appreciate any help, here is my code!
public void MysqlconnectInsert(string ampm)
myConnectionString = "server=localhost;uid=root;" +
conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = myConnectionString;
MessageBox.Show(ampm); // this shows the value am
MySqlCommand command = conn.CreateCommand();
// command.CommandText = "INSERT INTO `teleyapper`..`callees`(ampm) values('me')";
command.CommandText = "SELECT * FROM `teleyapper`..`callees`";
MySqlDataReader reader = command.ExecuteReader();
string retrieveampm = reader.GetString(0);
MessageBox.Show(retrieveampm); \\ this message box never shows
} //end of try
catch (MySql.Data.MySqlClient.MySqlException ex)
} //end of catch