| | |
error handling in VB6 + + ODBC + MySQL...(Help!!!!)
![]() |
•
•
Join Date: May 2006
Posts: 6
Reputation:
Solved Threads: 0
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
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.
you can use vartype to see if a variable is of a given data type.... for example:
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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If VarType(hWndOrForm) = vbLong Then ' /* Set hWnd To The Value Of The Passed Long */ hwnd = hWndOrForm Else ' /* Otherwise, It's A Form That Has been passed... Grab It's Handle */ hwnd = hWndOrForm.hwnd End If
![]() |
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- help on error handling in mysql ,in primary key (MySQL)
- ASP.NET Crystal Report ODBC MySQL (ASP.NET)
- ERROR 2002: Can't connect to local MySQL server (MySQL)
- PHP, ASP, ColdFusion, what's your fav? (IT Professionals' Lounge)
- odbc administrator (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Opening a form on click event in a different File
- Next Thread: Boolean checking
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






