p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ADO.NET (http://p2p.wrox.com/forumdisplay.php?f=109)
-   -   Help, trying to fill grid w/database items (http://p2p.wrox.com/showthread.php?t=29711)

itsajourney May 24th, 2005 03:43 PM

Help, trying to fill grid w/database items
 
Hi everyone, I am new

(Visual Basic) I am having a problem loading data into data grid on my form in Visual Studio from an Access db. Here is the line of code:

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DsStudent1.Clear()
        OleDbDataAdapter1.Fill(DsStudent1)

When I try to run it I get:

 An unhandled exception of type 'system.Data.OleDb.OleDbException
occured in system.data.dll

That last line of code is highlighted in debug mode

I've got my connection, adapter, and dataset.i have tested my connection and it works. I have set the data source and data members correctly to my ds. When I go to Preview Data, then click fill data set, it works fine. Just won't load to form. Tried using a button instead but still nothing. I am pretty positive that my steps to connect are right.

I am using the Jet 4.0 provider as directed by my teacher. Could it have something to do with the MSDE? I can't so much locate it on my machine. I thought I had it but after looking, couldn't find it, so I downloaded it from microsoft. But still no luck. I bet it is something easy, but I have spent sooooo many hours trying to figure it out

Quick replies are so very much appreciated. Thanks sooooooooooo much

~C



melvik May 24th, 2005 10:57 PM

Dear friend u fill dataSet by an Adapter & its OK!
but u should bind ur Data to ur Grid so do as:

this.dataGrid1.DataSource = this.DsStudent1;
this.dataGrid1.DataMember = "urDataTableName";

HTH.

Always:),
Hovik Melkomian.


All times are GMT -4. The time now is 09:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.