Database problem.....HELP

G

Guest

newbie trying to set up a Database and keep getting the same result. ERROR

An error occured while retrieving the information from the database:

Unable to cast COM object of type 'System._ComObject' to interface type
'Microsoft.VisualStudio.OLE.Interop.IServiceProvider'. This operation failed
because the QueryInterface call on th COM component for the interface with
IID '{65D5140C1-7436-11CE-8034-00aa006009FA}' failed with HRESULT: 0x80004002
(No such interface supported(Exception from HRESULT: 0x80004002
(E_NOINTERFACE))).

any help would be greatly appreciated.

Thanks DM
 
B

Bob Grommes

Much more info would be needed to help you.

What database? OS version? DB version? Configuration info?
Connection string? Is this happening when you connect, when you issue a
query, or someplace else? Sample code would be really useful here.

All I can tell from the error is you are probably using the OleDb client
library and something down in the basement plumbing has sprung a leak.

--Bob
 
G

Guest

Sorry so short on info......novice at work.....

I am just learing csharp and was going through a tutorial from microsoft and
learn visual studio.net .... there was no major code yet. Went to add a class
then seleceted SQL Database then set the name to MyCompany.mdf and clicked
add, then the Data Source Configuration Wizard window opens with this error.
the first part of the window says "Which database objects do you want in your
dataset?", the rest of the window has the error that I listed below. The only
choice that i have at the bottom of the window is the Previous or Cancel
button. I am sure that there is probably a whole procedure to setting up even
a basic database, but I know they did not show it in any of the tutorials so
far..... I have worked with other languages but never with csharp or c++ for
that matter...

Thanks for the POST.
DM
 
B

Bob Grommes

Sorry, DM, I have never used the wizard, I've always created my own
connections / commands and executed them myself. In general I've found
the visually added DB objects and wizard-assisted setup creates code
that is either inefficient and/or not a scalable and maintainable
design, plus for me at least it's a poor way to learn how everything works.

I would suggest obtaining a valid connection string that works with this
DB (verified in Access or some other interactive tool), then
programmatically create and open a connection, create a command, add any
needed parameters, etc. I would Google for something like "ADO.NET
basic tutorial" for fundamental code examples. Then, create a console
app whose sole purpose is to create and open a connection, create a
command object, and then return a query result and display a couple of
fields of the first 5 records. Do this with a DataReader and then with
a DataAdapter so you get a feel for how both work. Trap all errors and
step through your code with a debugger until you are satisfied that (a)
you understand it and (b) it works correctly.

When you have accomplished this then you can work it into something more
generally useful like a Winforms or ASP.NET app with some bound
controls. Take it step by step.

In my opinion, for what it's worth, avoid the "drop a connection onto a
form" approach. It is really only appropriate for the most trivial apps
and does not provide you with deep understanding of what you're doing.
Same goes for relying on CommandBuilders and the like, at least until
you understand how to build commands yourself so you can understand the
quirks and limitations of the hand-holding provided by generated commands.

Best,

--Bob
 

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