Dataset - what!!

  • Thread starter Thread starter Jim Bunton
  • Start date Start date
J

Jim Bunton

Visual Web Developer 2008

I am attempting to write the code to retrieve - within that code - data from an access database which I may then manipulate within the code.

having got thus far in some code
Imports System.Data.OleDb

Partial Class _Default

Inherits System.Web.UI.Page

.. . . . . . .

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Solutionsnet\RegularGuests\May2009\Web.mdb;User Id=admin;Password=;")

Dim da As New OleDbDataAdapter("SELECT * FROM Feedback WHERE Companyid = 10366", cn)

Dim dt As New OleDbConnection

I get into problems with all the examples I have found in websearches. They then want variously to dim and create new DataSets (or Datatables).

ANY reference I use for DataSets (or DataTables) gives errors

EG DIM ds as Dataset

Starts to give errors (and dataset or datatable aren't available in the intellisense tool!)



I guess I'm missing something simple BUT important here -

HELP!!
 
Imports System.Data
?


Looks like you may have just tacked on .OleDb to an existing line instead of adding a new one.


Visual Web Developer 2008

I am attempting to write the code to retrieve - within that code - data from an access database which I may then manipulate within the code.

having got thus far in some code
Imports System.Data.OleDb

Partial Class _Default

Inherits System.Web.UI.Page

. . . . . . .

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Solutionsnet\RegularGuests\May2009\Web.mdb;User Id=admin;Password=;")

Dim da As New OleDbDataAdapter("SELECT * FROM Feedback WHERE Companyid = 10366", cn)

Dim dt As New OleDbConnection

I get into problems with all the examples I have found in websearches. They then want variously to dim and create new DataSets (or Datatables).

ANY reference I use for DataSets (or DataTables) gives errors

EG DIM ds as Dataset

Starts to give errors (and dataset or datatable aren't available in the intellisense tool!)



I guess I'm missing something simple BUT important here -

HELP!!
 
when in doubt:

http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx



DataSet Class
Represents an in-memory cache of data.

Namespace: System.Data <<
Assembly: System.Data (in System.Data.dll)



See the "Namespace:". And see the "Assembly".

Make sure you have the reference to the assembly. Make sure you have the "using" ("imports" in VB.NET) statement(s) at the top of your .cs (.vb) file.





Imports System.Data
?


Looks like you may have just tacked on .OleDb to an existing line instead of adding a new one.


Visual Web Developer 2008

I am attempting to write the code to retrieve - within that code - data from an access database which I may then manipulate within the code.

having got thus far in some code
Imports System.Data.OleDb

Partial Class _Default

Inherits System.Web.UI.Page

. . . . . . .

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Solutionsnet\RegularGuests\May2009\Web.mdb;User Id=admin;Password=;")

Dim da As New OleDbDataAdapter("SELECT * FROM Feedback WHERE Companyid = 10366", cn)

Dim dt As New OleDbConnection

I get into problems with all the examples I have found in websearches. They then want variously to dim and create new DataSets (or Datatables).

ANY reference I use for DataSets (or DataTables) gives errors

EG DIM ds as Dataset

Starts to give errors (and dataset or datatable aren't available in the intellisense tool!)



I guess I'm missing something simple BUT important here -

HELP!!
 
SNIPPED ...

EG DIM ds as Dataset

Starts to give errors (and dataset or datatable aren't available in
the intellisense tool!)



I guess I'm missing something simple BUT important here -

HELP!!

In addition to importing System.Data.OleDb, you need to import System.Data,
as the DataSet itself is there. Depending on where the DataSet is
physically located in your tree, you may have an import statement for the
dataset as well



--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top