Problem With Access connectin to


Jun 21, 2004
Programming Experience
hi dennis(h0t) can anyone guide or help me???
.... i created a design (blank)database with Microsoft Access n wanted to created a new database to save cust's details with (runnin) so inside my microsoft access i got custid(primary key),custname,creditcardno.,no.ofnights,
so i used data wizard to create it ..
the connection i use is Microsoft Jet 4.0 OLE DB Provider
but i dont y when i refer the new record that i saved just now, it suddenly say error message about null value in custid??
????? ?????
Bad encounters of the jet4 kind

If I understand you correctly, you are struggling to insert a new record into your database from your application.

If this is the case, I can say that I have also encountered this problem. I dont know why one can't change an oledbdata-adapter's querys's commandtexts (straightforwardly , anyway)...

The way I got past this problem is as follows...
1. I created the connection (eg. con1) as I normally do.
2. Create a String (eg. bstring) object, that contains a normal "INSERT"-sql statement. Use controls such as textboxes to build the string.
3. Create a OleDB-command object as follows (the following is pseudo-code) :

dim com1 as new OleDB.OleDBCommand(con1,bstring)

4. Execute the Insert-statement as follows (pseudo-code again) :


5. Remember to close your connection when you have finished.

Hope this route works. It's the most direct I know of of solving this problem.