Page 1 of 1
c# Console app examples
Posted: Fri 29 Jul 2011 12:51
by garthl
I downloaded the Free version for a quick look - but all the examples/samples I saw were forms based examples - is there a C# Console Sample around anywhere that walks through the basics ?
Cheers and thanks
Posted: Fri 29 Jul 2011 13:28
by Shalex
Thanks ..
Posted: Mon 01 Aug 2011 05:15
by garthl
ok, that was a bit more basic than what I was expecting , but I managed to see what I needed, thanks
Im -><- this close to ordering a full copy btw, even though at the moment Im not using it to its full potential (I dont need all the design type and ER things)
One thing I seem to be missing, is an easy way of doing an 'executeScalar' SQL function, that is,
SELECT COUNT(*) From Table;
I see you have 'user defined' scalar functions, and 'ExecuteNonQuery' ..obviously Ive been able to execute a standard SQL query and look at the first (and hopefully only) row/column returned - coming from c++ and CPPSQLite3 there was an executeScalar function which was modelled on ADO.NET
I know, Im a PITA - any pointer you can throw at me would be appreciated
Posted: Tue 02 Aug 2011 12:21
by Shalex
garthl wrote:One thing I seem to be missing, is an easy way of doing an 'executeScalar' SQL function, that is,
SELECT COUNT(*) From Table;
Try this code:
Code: Select all
using (SQLiteConnection conn = new SQLiteConnection()) {
conn.ConnectionString = @"Data Source = d:\sqlitetest.db"; //change to your path
conn.Open();
SQLiteCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT COUNT(*) From Table";
int i = Convert.ToInt32(cmd.ExecuteScalar());
}
garthl wrote:I see you have 'user defined' scalar functions
Please refer to our blog article:
http://www.devart.com/blogs/dotconnect/ ... tions.html.
apologies
Posted: Tue 02 Aug 2011 22:22
by garthl
dont know how I missed that (ExecuteScalar()) d'oh - thanks ..for some reason I didnt see it
RTFM, then RTFM again I guess ..
expect a sale in the next 24 hours - thanks for your perserverence