Re: [sqlite] SQLite with Vis. Studio C#

2011-12-16 Thread jeff
Can you attach some code samples showing usage in that way?
Sent via BlackBerry from T-Mobile

-Original Message-
From: Don V Nielsen <donvniel...@gmail.com>
Sender: sqlite-users-boun...@sqlite.org
Date: Fri, 16 Dec 2011 08:53:41 
To: General Discussion of SQLite Database<sqlite-users@sqlite.org>
Reply-To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Subject: Re: [sqlite] SQLite with Vis. Studio C#

My application never uses a DataSet.  I push all db responsibility to
sqlite.  It returns DbDataReaders when I need to recurse through results.



On Thu, Dec 15, 2011 at 1:40 PM, Jeff Matthews <j...@xexam.net> wrote:

> Regarding my earlier question as to .NET SQlite syntax, I was wondering if
> I
> had to use DataAdapters and create and fill objects (DataSets), or not.
>
> Here is some sample code dealing with SQLite in C#:
> http://www.codeproject.com/KB/cs/SQLiteCSharp.aspx
>
> It looks to me like he is loading the database into a DataSet and then,
> doing his thing on the DataSet, rather than on the database directly.
>
> See how he is building his query as a string (surrounded by quotes) and
> then, calling a function to conduct it?
>
> Is this necessary - i.e., is this the only way to query and manipulate
> SQLite data from C#?
>
> I was thinking that we could just use sql statements literally, without
> having to send them as a string to a function.
>
> Does my question make sense?
>
> Can it not be done just using the sql literally and skipping all the
> DataAdapter, DataSet stuff?
>
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite with Vis. Studio C#

2011-12-16 Thread Don V Nielsen
My application never uses a DataSet.  I push all db responsibility to
sqlite.  It returns DbDataReaders when I need to recurse through results.



On Thu, Dec 15, 2011 at 1:40 PM, Jeff Matthews  wrote:

> Regarding my earlier question as to .NET SQlite syntax, I was wondering if
> I
> had to use DataAdapters and create and fill objects (DataSets), or not.
>
> Here is some sample code dealing with SQLite in C#:
> http://www.codeproject.com/KB/cs/SQLiteCSharp.aspx
>
> It looks to me like he is loading the database into a DataSet and then,
> doing his thing on the DataSet, rather than on the database directly.
>
> See how he is building his query as a string (surrounded by quotes) and
> then, calling a function to conduct it?
>
> Is this necessary - i.e., is this the only way to query and manipulate
> SQLite data from C#?
>
> I was thinking that we could just use sql statements literally, without
> having to send them as a string to a function.
>
> Does my question make sense?
>
> Can it not be done just using the sql literally and skipping all the
> DataAdapter, DataSet stuff?
>
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite with Vis. Studio C# Entity Framework 4.1

2011-12-14 Thread Don V Nielsen
While I love working with C# and Sqlite, I'm quite an amateur at it even
though I'm doing some sophisticated programming for my employer.  And even
less at exploiting the capabilities of Visual Studio in helping me.  Below
is a very typical routine for me.  I use string.Format a lot to assemble
the sql commands necessary to get the job done, as in the following
example.  DbWork is a property that contains the sqlite connection passed
to the class.  Its joining multiple tables and views (which are unions of
tables) in order to calculate a wgt'd average and apply the results back to
the input table.

private static void calculate_rtwgt(Segment seg, string lvl, Int32
depth)
{
DbTransaction trans = DbWork.BeginTransaction();

// TODO - I need to be sensitive to pool rank in the sequencing
// for each depth, calculate rte weights
for (int i = 1; i <= depth; i++)
{
using (SQLiteCommand cmd = DbWork.CreateCommand())
{
cmd.Parameters.Add(SegmentController.SqlprmDepth);
cmd.CommandText = String.Format(
@"update {0} set {11} =
(
  select avg(rowid) from
  (
select pr.rowid
from {1} as m1
inner join {2} as p on p.{5} = m1.{5} and p.{6} = m1.{6}
inner join {3} as pr on pr.{7} = p.{7} and pr.{8} = p.{9}
where m1.{4} = {0}.{4}
order by pr.rowid
limit {12}
  )
)
where {0}.{4} in
(
  select m2.{4} from {1} as m2 where m2.{10} = {12}
);
",
seg.TblNameMatches,
seg.ViewNameMatches,
seg.ViewNamePools,
AddPoolController.POOL_PRIORITIES_TABLE_NAME,
SegmentController.SEG_COL_NEEDID,
TblZipRoute.ZR_COL_ZIP,
TblZipRoute.ZR_COL_CRRT,
TblZipRoute.ZR_COL_PRTY,
AddPoolController.POOL_COL_POOLID,
TblZipRoute.ZR_COL_ID,
lvl,
SegmentController.SEG_COL_ROUTE_WEIGHT,
SegmentController.SqlprmDepth.ParameterName
);

SegmentController.SqlprmDepth.Value = i;
cmd.ExecuteNonQuery();

}
}

trans.Commit();
trans.Dispose();
}
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite with Vis. Studio C# Entity Framework 4.1

2011-12-13 Thread Joe Mistachkin

Jeff Matthews wrote:
>
> Is it possible for you, or anyone else, to send an e-mail to me, attaching
> a sample SQLite database and some examples of simple uses of C# for
searching,
> relations, adds, changes. etc.   Nothing fancy, please.   Just minimal so
it's
> easy to follow.  Or maybe, there is a link to material like this.
> 

Here are a couple links I found searching Google for "System.Data.SQLite"
and
"tutorial" (there are many more):

http://msdn.microsoft.com/en-us/magazine/ff898405.aspx 

http://sqlite.phxsoftware.com/forums/t/76.aspx

>
> I think I want to download and get started.   
>

Great.

>
> My direct e-mail is j...@xexam.net
>

CC'd on this message.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users