SQL SELECT statement

  • Thread starter Thread starter Tom McLaughlin
  • Start date Start date
T

Tom McLaughlin

I'm having a problem understanding the syntax of the
SQL SELECT statement in Visual Basic. Can someone
point me to some examples.

Thanks

Tom
 
Hi Tom,

If you are using SQL Server, then Books-Online help, which comes with SQL
Server contains a lot of different examples. SQL statements are not in VB or
C#. If you know syntax of SQL statement in general, then you will use exact
same syntax when you execute it from VB. If you would like to execute
something from VB and it does not work, then you could post your code here
and you should be more specific
 
Tom:

What problem are you having? Is it something specific to SQL/VB.NET
interaction or is it essentially a scenario w/ SQL itself?
 
I'm new at this and I'm trying to under stand the syntax of the Select
method using VB.net.

When I try the following sql statement selecting only one table everything
work.

Dim ds As New DataSet()
Dim OledbPubsConnString as string="C:\BIBLIO.MDB
Dim sql As String = "SELECT * FROM Publishers"
Dim cn As New OleDbConnection(OledbPubsConnString)
Dim da As New OleDbDataAdapter((sql, cn)
da.Fill(ds, "Publishers")


But if I were to change the sql statement to select more then one table as
follows:

Dim sql As String = "SELECT * FROM Publishers;SELECT * FROM Titles;SELECT *
FROM Authors"

I receive the following error message:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll

What is it that I'm missing ??

Thanks
 
Hi Tom:

Access doesn't support batch queries, so you'll need to call 3 sepearate
calls to fill.
 
Hi Tom,

As I know batches supported only with OLEDB .NET Managed provider for SQL
Server or OLEDB provider for SQL Server. They do not work with the Access
database
 
I don't understand, I have three books all from Microsoft Press
(Microsoft ADO.NET step by step, Programming Microsoft Visual
Basic.NET, and Microsoft Visual Basic.NET step by step) that
use this exact example but you say it is not supported?
 
Back
Top