[dba-VB] OleDBAdapter vs SQLDataAdapter

chizotz at mchsi.com chizotz at mchsi.com
Mon Nov 15 13:19:39 CST 2004


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
> 




More information about the dba-VB mailing list