Hi all,
After I open a connection between an Access database and my project I try to drag the database node onto the Windows Form but it always fail I am not able to create an OleDbConnection to the data source. How this problem can be solved?

regards
Khaled

do you get any error messages when this happens?

Hi Alex,

Thank for your reply, but really I do not receive any error messages it just does nothing. The connection is opened and I can test it but the problem is when I drag the database node from the database explorer to the Windows Form it does nothing.
I am working on an Express Edition of VC#, do you think this may be the cause of the problem?

I also noticed that I do not have an OleDbDataAdpater in the Toolbox of this edition.

The connection with the database is working well in the Console environment, I tried the sample application in the Help.

regards
Khaled

Are you just dragging a connection component into your form and setting it up, or are you allowing Visual Studio to build a typed dataset? Or, maybe you are trying to drag objects from Database Explorer, which doesn't work.

First, you need a project open. Then on the C# menu, select Data, Add New Datasource. Go through the dialogs to indicate what you want to connect to, then VS will generate the connection, dataset, adapters and binding sources needed. The tables (and possibly other data objects) will be displayed in the Data Sources window. If it doesn't appear automatically, use the menu selection Data, Show Data Sources to open it. It is the Data Sources window which you use to drag tables and other data objects to your form to automatically add the controls and components needed.

Hope that helps.

Are you just dragging a connection component into your form and setting it up, or are you allowing Visual Studio to build a typed dataset? Or, maybe you are trying to drag objects from Database Explorer, which doesn't work.

First, you need a project open. Then on the C# menu, select Data, Add New Datasource. Go through the dialogs to indicate what you want to connect to, then VS will generate the connection, dataset, adapters and binding sources needed. The tables (and possibly other data objects) will be displayed in the Data Sources window. If it doesn't appear automatically, use the menu selection Data, Show Data Sources to open it. It is the Data Sources window which you use to drag tables and other data objects to your form to automatically add the controls and components needed.

Hope that helps.

Thank for your reply, I used the DataGridView and then I chose a data source, the table appeared in the DataGridView but empty . The name of my database is "Books.mdb ", the name of the class is "DisplayDB ", when I tried to build the project I got two errors:

Error1
The type name 'BooksDataSet' does not exist in the type
'DisplayDB.DisplayDB' C:\Documents and Settings\dr.khaled\Local Settings\Application Data\Temporary Projects\DisplayDB\Program.cs

Error2
The type name 'BooksDataSetTableAdapters' does not exist in the type 'DisplayDB.DisplayDB 'C:\Documents and Settings\dr.khaled\Local Settings\Application Data\Temporary Projects\DisplayDB\Program.cs

regards
Khaled

Let me explain a way to do this, step by step.

Open a new project. From the main menu select Data | Add new data source. In the Configuration Wizard select Database and then click Next. In the window labeled "Choose your connection" you will hopefully see your connection. If not, you can try to create it with the New Connection button but just what happens depends on what kind of data you are using (Access, SQL Server, ???).

If you find your data, click Next until you get to the window labeled "Choose your database objects". You need to open the Tables group and then select the tables you want to work with by clicking the little boxes next to the tables. Then, click Finish. NOTE-If any of these steps fail, you probably have not set up a valid connection to your data. Fixing that gets complicated and it depends on what your data is. If it is Access it is usually fairly simple to fix. If it is SQL Server, you may have a problem as there are a lot of variables and you will need help from someone who knows more than I do.

Now you have created a typed dataset. Use the VS menu to select Data | Show data sources You should see your data and the table or tables you selected. You can drag the table to a form to create controls. Run the program to see the actual data (VS does not show it during design, unfortunately).

Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.