From: Pavol S. <pa...@st...> - 2003-03-04 09:29:10
|
hi, yes that example is wrong; using System; using System.Data; using FirebirdSql.Data.Firebird; public class Test { public static void Main(string[] args) { string connectionString = "Database=C:\\PROGRAM FILES\\FIREBIRD\\EXAMPLES\\EMPLOYEE.GDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost"; IDbConnection dbcon = new FbConnection(connectionString); dbcon.Open(); -> IDbTransaction dbtran = dbcon.BeginTransaction(); IDbCommand dbcmd = dbcon.CreateCommand(); string sql = "SELECT * FROM employee"; dbcmd.CommandText = sql; -> dbcmb.Transaction = dbtran; IDataReader reader = dbcmd.ExecuteReader(); while(reader.Read()) { object dataValue = myReader.GetValue(0); string sValue = dataValue.ToString(); Console.WriteLine("Value: " + sValue); } // clean up reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; -> dbtran.Commit(); -> dbtran.Dispose(); dbcon.Close(); dbcon = null; } } aspxDelphi wrote: >Hi, all > >I'm trying to compile that C# sample code from >http://www.go-mono.com/firebird.html - an example of using >firebird-net-provider on Firebird/Interbase... > >While trying to build a sample aspx page using the code from the link above, >the >"Command must have a valid Transaction" >comes on the line: >IDataReader reader = dbcmd.ExecuteReader(); > >Anybody? > >............................................. >Zarko Gajic, webmaster to >aspxDelphi.net - bringing the world of >ASP.NET to Delphi developers >http://www.aspxdelphi.net >email: web...@as... >............................................. > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger >for complex code. Debugging C/C++ programs can leave you feeling lost and >disoriented. TotalView can help you find your way. Available on major UNIX >and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Firebird-net-provider mailing list >Fir...@li... >https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > > |