error handling in VB6 + + ODBC + MySQL...(Help!!!!)

Reply

Join Date: May 2006
Posts: 6
Reputation: naramis is an unknown quantity at this point 
Solved Threads: 0
naramis naramis is offline Offline
Newbie Poster

error handling in VB6 + + ODBC + MySQL...(Help!!!!)

 
0
  #1
Jun 14th, 2006
hello there,

im doing a program of consolidate database. however, my scope is to do it automatically. so far, i have designed a timer and also codes to insert the data from excel file into MySQL database. then, my idea is whenever there is an error occured in a particular rows of data, the program will capture the rows that have error and put/paste it in one temporary excel files..then continue inserting other rows. does anyone have any idea how to do this. if possible can i have the source code of this. thanx in advance!!

this is part of my program to insert data into the database;

Row = 2
Col = 1
Do While oexcel.Cells(Row, Col) <> ""

rsCVM.MoveFirst

rsCVM.AddNew
rsCVM!USER_NAME = CStr(oexcel.Cells(Row, 1))
rsCVM!DAY = CStr(oexcel.Cells(Row, 2))
rsCVM!USER_ID = CStr(oexcel.Cells(Row, 3))
rsCVM!ADDRESS = CStr(oexcel.Cells(Row, 4))
rsCVM!CONTACT_NO = CStr(oexcel.Cells(Row, 5))
rsCVM!POINT = CSng(oexcel.Cells(Row, 6))

rsCVM.Update
StatBar.Panels(1).Text = "Inserted " & Row - 1 & " data of " & numData & " into database"
Row = Row + 1
Loop
Last edited by naramis; Jun 14th, 2006 at 10:36 pm.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: error handling in VB6 + + ODBC + MySQL...(Help!!!!)

 
0
  #2
Jun 14th, 2006
What kind of errors?
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 6
Reputation: naramis is an unknown quantity at this point 
Solved Threads: 0
naramis naramis is offline Offline
Newbie Poster

Re: error handling in VB6 + + ODBC + MySQL...(Help!!!!)

 
0
  #3
Jun 15th, 2006
Hi,
Thanx for ur quick reply. Anyway, the error that will possibly occured is type (format) or length of the data that to be inserted are not the same as been declared in the table in MySQL database.
Thanx.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: error handling in VB6 + + ODBC + MySQL...(Help!!!!)

 
0
  #4
Jun 15th, 2006
you can use vartype to see if a variable is of a given data type.... for example:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If VarType(hWndOrForm) = vbLong Then
  2. ' /* Set hWnd To The Value Of The Passed Long */
  3. hwnd = hWndOrForm
  4. Else
  5. ' /* Otherwise, It's A Form That Has been passed... Grab It's Handle */
  6. hwnd = hWndOrForm.hwnd
  7. End If
checks to see if the variable is of type long. If it's about formatting, you can use the format$ function to reformat the data they posted (for example, a date in the wrong layout), or you could split apart the string and see if unauthorized characters (letters in a currency field) are found...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC