[dba-VB] OleDBAdapter vs SQLDataAdapter

Nicholson, Karen cyx5 at cdc.gov
Mon Nov 15 13:24:17 CST 2004


So if my @startdate is an unbound field on a form, then @startdate =
me.startdate.value?

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of
chizotz at mchsi.com
Sent: Monday, November 15, 2004 2:20 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] OleDBAdapter vs SQLDataAdapter


You can parameters to the data adapter select command. Here's a C#
example, 
which you should be able to adapt to VB pretty easily:

dsADARpt1.Clear();
daADARpt.SelectCommand.Parameters["@startDate"].Value = startDate;
daADARpt.SelectCommand.Parameters["@endDate"].Value = endDate;
daADARpt.Fill(dsADARpt1);

The SQL in the data adapter uses the parameters basically exactly as you
are 
used to, for example the SQL in the above referenced data adapter
includes a 
line:

WHERE (dw_draw1.draw_date >= @startDate) AND (dw_draw1.draw_date <=
@endDate)

I hope that helps.

Ron

> I read that if a database has an SQL backend, then use the
> SQLDataAdapter in VB.net.  OK... So, up until this point I have used
OLE
> and could pass parameters easily, for instance:
> 
> Select au_id, au_lname, state from authors where (state = ?)
> 
> If I am using the SQLDataAdapter this bombs.  What is the SQL
> equivalent, or is this a bad idea to even use the SQL adapter?
Learning
> is such a bear.
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list