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

  • Thread starter Thread starter daub815
  • Start date Start date
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()
 
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
 
Back
Top