User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 375,199 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,121 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Views: 412 | Replies: 5
Reply
Join Date: Apr 2008
Posts: 4
Reputation: khaled_nagaty is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
khaled_nagaty khaled_nagaty is offline Offline
Newbie Poster

OLeDb Connection fail

  #1  
May 9th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,330
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 101
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: OLeDb Connection fail

  #2  
May 9th, 2008
do you get any error messages when this happens?
Alex Cavnar, aka alc6379
Reply With Quote  
Join Date: Apr 2008
Posts: 4
Reputation: khaled_nagaty is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
khaled_nagaty khaled_nagaty is offline Offline
Newbie Poster

Re: OLeDb Connection fail

  #3  
May 11th, 2008
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
Last edited by khaled_nagaty : May 11th, 2008 at 7:03 am.
Reply With Quote  
Join Date: Aug 2007
Location: Gunnison, Colorado
Posts: 54
Reputation: fishsqzr is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
fishsqzr fishsqzr is offline Offline
Junior Poster in Training

Re: OLeDb Connection fail

  #4  
May 11th, 2008
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.
Reply With Quote  
Join Date: Apr 2008
Posts: 4
Reputation: khaled_nagaty is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
khaled_nagaty khaled_nagaty is offline Offline
Newbie Poster

Re: OLeDb Connection fail

  #5  
May 13th, 2008
Originally Posted by fishsqzr View Post
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
Reply With Quote  
Join Date: Aug 2007
Location: Gunnison, Colorado
Posts: 54
Reputation: fishsqzr is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
fishsqzr fishsqzr is offline Offline
Junior Poster in Training

Re: OLeDb Connection fail

  #6  
May 14th, 2008
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C# Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 2:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC