![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM ODBC Driver » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Wed, May 12 2010 3:03 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. ![]() | Hi Mike,
Something like this in C# try { using (OdbcCommand MyCommand = new OdbcCommand("",MyConnection)) { string Sql = ""; if (Exists == false) Sql = "INSERT INTO TableName (Title,Description) VALUES (?,?)"; else Sql = "UPDATE TableName SET Title=?,Description=? WHERE Recno=?"; MyCommand.CommandText = Sql; MyCommand.Parameters.Clear(); MyCommand.Parameters.Add("Title", OdbcType.VarChar, 50); MyCommand.Parameters.Add("Description", OdbcType.Text); MyCommand.Parameters.Add("Recno", OdbcType.Int); MyCommand.Parameters["Title"].Value = Title; MyCommand.Parameters["Description"].Value = Description; MyCommand.Parameters["Recno"].Value = Recno; MyCommand.ExecuteNonQuery(); } } catch (OdbcException OE) { MessageBox.Show(OE.Message, "Error saving Description to disk", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } -- Chris Holland [Team Elevate] |
Wed, May 12 2010 10:43 AM | Permanent Link |
Mike | THANKS!!!!!!!!!!!!!!!!!
Chris Holland wrote: Hi Mike, Something like this in C# try { using (OdbcCommand MyCommand = new OdbcCommand("",MyConnection)) { string Sql = ""; if (Exists == false) Sql = "INSERT INTO TableName (Title,Description) VALUES (?,?)"; else Sql = "UPDATE TableName SET Title=?,Description=? WHERE Recno=?"; MyCommand.CommandText = Sql; MyCommand.Parameters.Clear(); MyCommand.Parameters.Add("Title", OdbcType.VarChar, 50); MyCommand.Parameters.Add("Description", OdbcType.Text); MyCommand.Parameters.Add("Recno", OdbcType.Int); MyCommand.Parameters["Title"].Value = Title; MyCommand.Parameters["Description"].Value = Description; MyCommand.Parameters["Recno"].Value = Recno; MyCommand.ExecuteNonQuery(); } } catch (OdbcException OE) { MessageBox.Show(OE.Message, "Error saving Description to disk", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } -- Chris Holland [Team Elevate] |
This web page was last updated on Thursday, July 10, 2025 at 10:36 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |