From: Karl S. <web...@st...> - 2003-03-17 17:46:44
|
Hello all, Konfiguration: fb 1.5 win beta4 latest .net-provider .net sdk 1.1 the following sourcecode works fine for the select-statement, but makes an exception at the insert-statement. With firebird 1.02, the code went fine Sure, there's no 'test' in the table Thanks, KS using System; using FirebirdSql.Data.Firebird; class MainClass { public static void Main(string[] args) { // If the connection string is null, use a default. string myConnectionString = "Database=C:\Employee.gdb;User=SYSDBA;Password=masterkey;Dialect=3;Server=lo calhost"; FbConnection myConn = new FbConnection(myConnectionString); myConn.Open(); string mySelectQuery = "SELECT * FROM employee"; FbTransaction mynewTxn = myConn.BeginTransaction(); FbCommand myCommand = new FbCommand(mySelectQuery, myConn, mynewTxn); // myConn.Open(); FbDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { Console.WriteLine(myReader.GetValue(0) + " " + myReader.GetValue(2)); } } finally { // always call Close when done reading. myReader.Close(); } string myInsertQuery = "INSERT INTO PROJECT(proj_id, proj_name, product) Values('test', '.Net Provider', 'N/A')"; FbCommand myFbCommand = new FbCommand(myInsertQuery, myConn, mynewTxn); int result = myFbCommand.ExecuteNonQuery(); mynewTxn.Commit; myConn.Close(); Console.WriteLine(result); } } Unhandled Exception: FirebirdSql.Data.Firebird.FbException: validation error for column PROJ_ID, value "test " ---> FirebirdSql.Data.INGDS.GDSException: Exception of type FirebirdSql.Data.IN GDS.GDSException was thrown. at FirebirdSql.Data.Firebird.FbStatement.Execute() at FirebirdSql.Data.Firebird.FbCommand.ExecuteNonQuery() --- End of inner exception stack trace --- at FirebirdSql.Data.Firebird.FbCommand.ExecuteNonQuery() at MainClass.Main(String[] args) in c:\Dokumente und Einstellungen\Administra tor\Eigene Dateien\SharpDevelop Projects\hjghj\Main.cs:line 47 Drücken Sie eine beliebige Taste . . . |