PC Review


Reply
Thread Tools Rate Thread

How to Access Data Using Query?

 
 
Sasha
Guest
Posts: n/a
 
      26th Feb 2004
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
 
Reply With Quote
 
 
 
 
Cor
Guest
Posts: n/a
 
      26th Feb 2004
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
> 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



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      26th Feb 2004
* (E-Mail 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:

<news:microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I convert row data to column data in Access design query =?Utf-8?B?VHJhbnNwb3NlIGRhdGEgaW4gcm93cyB0byBjb2x1 Microsoft Access Queries 7 22nd Feb 2008 07:32 PM
Data too large for Excel, need to query Access data for results Susan Microsoft Excel Programming 8 9th Mar 2006 03:02 PM
why access 2003 drop data when moving from a query to access page =?Utf-8?B?Ymx1ZXllemNhc3M=?= Microsoft Access Reports 0 25th Jan 2006 10:51 PM
Linking problem - Access query to MS query to extract data to Exce =?Utf-8?B?RmF0TWFu?= Microsoft Access Queries 0 23rd Nov 2004 06:43 PM
Multi-Table Query/Data Access Page--can't edit data =?Utf-8?B?RGF2aWQgQ2FycGVudGVy?= Microsoft Access Queries 0 26th Jan 2004 05:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 PM.