From: aspxDelphi <web...@as...> - 2003-03-04 09:45:59
|
Thanks, works, and works with Delphi too. ............................................. Zarko Gajic, webmaster to aspxDelphi.net - bringing the world of ASP.NET to Delphi developers http://www.aspxdelphi.net email: web...@as... ............................................. ----- Original Message ----- From: "Pavol STAREK" <pa...@st...> To: "aspxDelphi" <web...@as...>; "FirebirdNetProvider" <fir...@li...> Sent: Tuesday, March 04, 2003 10:34 AM Subject: Re: [Firebird-net-provider] A problem with C# sample code > 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 > > > > > > > > |