Subject Re: [firebird-support] C# INSERT not going thru
Author Sandeep Chandra
James Dunkley wrote:

>Hello;
>
>this code below runs without error, it looks like it does Insert but then checking database from console verifies nothing has happened.
>
>Sorry I'm new,
>
>thank all of you in advance!
>
>
>
>
>
>
>
>public void InsertRow(string myConnectionString)
>
>{
>
>// If the connection string is null, use a default.
>
>if(myConnectionString == "")
>
>{
>
>myConnectionString = "Database=DATA.FDB;User=me;Password=pass;Dialect=3;Server=host";
>
>}
>
>
>
>FbConnection myConn = new FbConnection(myConnectionString);
>
>
>
>myConn.Open();
>
>
>
>
>
>FbTransaction myTxn = myConn.BeginTransaction();
>
>string myInsertQuery = "INSERT INTO INFO(name, phone) Values ('luutf', 'uytd')";
>
>FbCommand myFbCommand = new FbCommand(myInsertQuery, myConn, myTxn);
>
>
>
>myFbCommand.ExecuteNonQuery();
>
>myConn.Close();
>
>}
>
>
I think you are missing myTxn.Commit ();

Regards

Sandeep