MySQL / c#

Associate
Joined
6 Apr 2007
Posts
306
Location
Hull, UK
Could anyone give me some pointers on this problem. Been playing about with it for a few hours and I'm going round in circles.

Its been quite a learning curve this afternoon / evening (well to a novice) getting an Arduino to communicate over Xbee, then having this program pick up the serial data and attempt to put it into a database at timed intervals.

Code:
string SQLquery = @"INSERT into Kingswood_outside1 (date, time, temp) VALUES (CURDATE(), CURTIME(), " +strTempData+ ");";
            try
            {
                connection = new MySqlConnection();
                connection.ConnectionString = cs;
                connection.Open();
                MySqlCommand cmd = new MySqlCommand(SQLquery, connection);
                cmd.ExecuteNonQuery();
                connection.Close();

Its coming up with an exception everytime and I know its something to do with how I'm inserting the variable in the SQL query but I can't for the life of me work out how to fix it.

Once the exception has been caught, the program sits there quite happily doing what I want it to... just frustrating having the error.

Anyone any pointers?


Thanks!
 
Last edited:
Back
Top Bottom