Using Access with Data Object Connections

  • Thread starter Thread starter Curt Emich
  • Start date Start date
C

Curt Emich

Is it possible to use Access with the data objects in the toolbox of a web
form? In other words, I'm trying to use OleDbConnection to connect to my
Access database, but I'm not sure how to get it to show up in the list of
servers in the Datalink dialog, which shows up when I drag an
OleDbDataAdapter onto the screen.

Is Access really only useable directly from code?
 
Hi Curt,

No, it works in design time also.
One way is to:
Go to server explorer, create a new Jet 4.0 link to your database.
Expand it.
Drag & drop a table or tables to the form - it will create oledbconnection
(if one is not present) and an adapter for each table.
 
I have another question about this process of getting a connection set
up and then populating a drop-down list box with a query.

I was able to create a connection like you said, and then I created a
data adapter. I then clicked on "generate dataset" and named a dataset
to be created from a query I specified. I get this build error:

"The type or namespace name 'dsStatements' does not exist in the class
or namespace 'TrainOfThought.TrainOfThought' (are you missing an
assembly reference?)"

"dsStatements", of course, is the name of the dataset. "TrainOfThought"
is the name of the application and the namespace and the main class.
The code doesn't seem to generate a dataset object. Instead, I get this
code at the top of the "TrainOfThought" class:

protected System.Data.OleDb.OleDbConnection cnnTrainOfThought;

protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;

protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;

protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;

protected System.Data.OleDb.OleDbDataAdapter adaStatements;

protected System.Data.OleDb.OleDbCommand cmdSelectStatements;

protected TrainOfThought.dsStatements dsStatements1;

protected System.Web.UI.WebControls.DropDownList DropDownList1;


The second to last line is the problem. I can't see why it's generated
the way it is. I would expect it to come from System.Data.Dataset, not
"TrainOfThought.dsStatements". Does anyone know what I'm doing wrong
here or how I can work around it?
 
Back
Top