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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What should I choose: ODBC or Microsoft JET 4.0 ?

Status
Not open for further replies.

Toranaga

Programmer
Nov 14, 2002
11
RO
I have a VB application in which I connect to a database using OLE DB for ODBC drivers and DataEnvironment. The problem is that I'm not using neither SQL Server nor MSDE. So I ask, if someone could tell me, is it necessary to use ODBC or is better to use JET ? And what are the advantages/disadvantages between JET and ODBC ?
I have another problem: I'm using DataEnvironment and I have connection to a database (I've tried both with ODBC and JET). I put a DataGrid control on a form, which shows the records from a the table Tb1. The DataGrid control is bound to DataEnvironment, to a command which gets data fro Tb1. Then I manually create another ADODB connection, and I insert a record in Tb1, like this:

Dim MyConn as New ADODB.Connection
MyConn.ConnectionString = "......"
MyConn.Open
MyConn.Execute "INSERT INTO bla bla ..."

This operation goes well, the record is added in Tb1, but the problem comes when I try to requery the DataGrid, because it doesn't requery the first time I call the requery procedure. I did the requery operation in two ways, which I'M SURE THEY'RE BOTH CORRECT, I also rebind the DataGrid control, but I still can't understand why I have to click two times the requery button in order to see in the DataGrid the newly added record. I wanna say that the problem doesn't come from the DataGrid, but from the recordset of DataEnvironment, because I made a procedure to display the records from the recordset and after the first requery, it doesn't have the new record, it shows the correct records only after the second requery operation.

I would really appreciate if someone could help me solve at least one of the problems above.
Thanx in advance.


 
I don't fool with the data environment because it doesn't seem to handle connections very well. I prefer to connect to the database via code. Or you could use the ADO Data Control, where you can specify your connection string. I would use the OLE DB Provider for Jet 4.0 rather than ODBC because OLEDB is one less layer to access the db. A sample connection to JET using ADO is :

Dim objConn as adodb.connection
Set objConn = New adodb.connection

objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\AccessDB\MDSports.mdb;" & _
"Persist Security Info=False"

If you want to use the ado control then you can use the connect string wizard to build your connection.
 
Thank you for your suggestion, I think I'll use OLE DB Provider for Jet 4.0., and I'll quit using DataEnvironment, because I got only troubles since I started using it. I don't mean that DataEnv. is not a powerfull tool (because of its cascade recordsets, and how easy they can be bound to grids), but it would have been great if there wasn't the problem with the conections - which I still hope there is a way so solve it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top