Select Query doesn't Work in VB.NET, but Does in Access

D

daub815

In Access, the SQL statement works, but using VB.NET it doesn't. I
think its able to create a connection because its not giving me an
error, but it never returns anything. Could someone let me know what I
could be doing wrong? Thanks.

Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\inetpub\wwwroot\csc245\Project\dvd.mdb;"
Dim strCategory As String = rblCategory.SelectedValue
Dim strSQL As String
Dim theConnection As New OleDbConnection
Dim theCommand As New OleDbCommand

strSQL = "Select * From DVD;"


theConnection = New OleDbConnection(strConnection)
theConnection.Open()
theCommand = New OleDbCommand(strSQL, theConnection)

Response.Write(strSQL)
Response.Write(theCommand.ExecuteNonQuery)
theConnection.Close()
 
P

Peter Foot [MVP]

Thats not a Compact Framework question, however you need to remove the
semicolon from your query. If you have any further questions on desktop VB /
Access try posting them to an appropriate group such as
microsoft.public.dotnet.adonet

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ADO Connections 1
Line break VB.NET 4
Error 1
REGDB_E_CLASSNOTREG(0x80040154). 1
GetSchemaTable and Primary Keys 2
Select with Sybase OleDb provider 0
How to connect to Excel ? 3
ADD RECORDS 14

Top