Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using VB .NET to get data from and to an AS400 1

Status
Not open for further replies.

nplastics

Programmer
Jun 29, 2001
6
US
I know a lot about VBA and a little about VB 6.0. I'm currently trying to use VB .NET to access data in a file called "vacation" in a library/collection called SQLDBA. I started a new VB project and set up my data connections. I can see the Vacation file and all the fields in it. However, when I click and drag a field to the empty form, I receive an error that says: "You can not use an OLE DB provider for ODBC drivers". I also tried the "IBM AS400 OLE DB provider" but with that I can see nothing on the AS400.

Any ideas or is it obvious I'm over my head?
 
Can you provide more information - say, about your vb.nt code? Also, is that the exact/verbatim error message you get ("You can not use an OLE DB provider for ODBC drivers")?
 
Dimandja,

Yes, that is the error verbatim. I went to Microsoft's site to see if I could get help out there but didn't see anything. I don't have code out there per se (just what is built automatically as I created the form and controls). I want to build a bound controls to the fields I have existing on the AS400. I set the server connections as I mentioned above and can see everything on the AS400 and can even pull it down to a simple spreadsheet in VB .NET but I can't click and drag a field to a form. I have the Enterprise Edition of .NET.
 
"You can not use an OLE DB provider for ODBC drivers".
Sounds like you're using an ODBC driver with the OLEData... classes. Probably not going to succeed with this approach.

I also tried the "IBM AS400 OLE DB provider" but with that I can see nothing on the AS400.
Did you specify the correct library? If I recall, it's "Library.TableName" in place of the usual "TableName" in the connection properties. Could be wrong - haven't worked with an AS/400 since two jobs ago.

Chip H.
 
Thank you, Chip H., that helped (using Library.tablename). I think I've set up the OleDBConnection and OleDBData Adapter properly. My problem is still probably VB 101 - how to put on a control that is bound to a field on my AS400. I don't seem to have the same options as I did in 6.0. I think I need a .NET for dummies book.
 
You could also try importing the data into an Access file or SQL Server if you have it (actually linking to Access) and using that as the data source for your VB forms. You shouldn't have problems connecting to the DSN there.

VB 6 would probably be easier to connect to it in my opinion, using a DSN to connect an ADO.

You could also try referencing ADO in your .Net project, and dimming a connection, recordset, etc. in your code.
 
More info.....

I have established an OleDBConnection1. When I go through the wizard to create my OleDBAdapter1 it says: "Failed to get schema for this query."

Possibly this is a problem on my AS400 side. However, I can see the data in the query builder.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top