How to Access Data Using Query?

  • Thread starter Thread starter Sasha
  • Start date Start date
S

Sasha

Hi All,

I am new to VB.Net and am having a problem with the below code. I am
trying to fill in a datagrid with the below query but it keeps giving
me error where the *'s are located below. I have an OleDbDataAdapter,
OleDbConnection and DataSet on my form.

This is the actual error:
An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll


Thanks
Mathew


Private Sub frmGetData_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim result
OleDbDataAdapter1.SelectCommand.CommandText = "SELECT
JobTitle, PrimaryJob.* FROM PrimaryJob WHERE JobTitle ='" & gStrTitle
& "'"
ProdDataSet.Clear()
*** OleDbDataAdapter1.Fill(ProdDataSet)***
End Sub
 
Hi Sasha,

The most simple things to find a problem yourself is:
Use a try catch end try block
Narrow your problem down.

In this case you can start with this narrow it down.
You know you have everything done, but your select statement can be the
bottleneck.
Try that first with

Select * from PrimaryJob

Is that working than you know your problem, if not than it is outside the
code you provided.
(and if it is working you can add piece by piece to your select)

I hope this helps?

Cor
I am new to VB.Net and am having a problem with the below code. I am
 
* (e-mail address removed) (Sasha) scripsit:
This is the actual error:
An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll

You will more likely get an answer here:

<
 
Back
Top