struggling vb6 enthusiast wants help

R

ROBERT BEE

Below is some code I have copied from the web with the intention of
modifying but I keep getting the stated errors. This is the umpteenth
attempt at trying to get
OleDbConnection,OleDbDataAdapter to work without any success. Do the
references have a hierarchy like in vb6 or is there something else I am
missing?


Many Thanks in advance

Buzz



'error

c:\inetpub\wwwroot\WebAppl tion6\WebForm1.aspx.vb(25): Type
'OleDbDataAdapter' is not defined.
c:\inetpub\wwwroot\WebApplication6\WebForm1.aspx.vb(24): Type
'OleDbConnection' is not defined.

'references

ADOR
SYSTEM.DATA
SYSTEM.DRAWING
SYSTEM.WEB
SYSTEM.XML

'aspx page

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>


'code

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim oConn As OleDbConnection

Dim oComm As OleDbDataAdapter

Dim sConn As String

Dim sComm As String

Dim oDataSet As New DataSet

'Build the connection string

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"

sConn += "Data Source=C:\Inetpub\wwwroot\Sample\grocertogo.mdb;"

sConn += "Persist Security Info=False"

'Build the SQL string sComm = "SELECT Products.ProductID, "

sComm += "Products.ProductName, "

sComm += "Products.ProductDescription, "

sComm += "Products.UnitPrice "

sComm += "FROM Products"

'Usually you would use error-handling here. It is left out to

'make the code as simple as possible.

'Create the connection and command objects

oConn = New OleDbConnection(sConn)

oComm = New OleDbDataAdapter(sComm, oConn)

'Fill the dataset with the results of the query

oComm.Fill(oDataSet, "Products")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top