If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > (Problem) Insert data error by VB6 with DB2 V7

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-15-03, 11:37
cwchan2 cwchan2 is offline
Registered User
 
Join Date: Oct 2003
Posts: 1
(Problem) Insert data error by VB6 with DB2 V7

I am using Win 2k, VB 6.0 with service pack 5, DB2 V7.1

I have the following program


---------------------------------------------------
Dim conInsert As ADODB.Connection
Dim cmdChange As ADODB.Command

Set conInsert = New ADODB.Connection
conInsert.Mode = adModeReadWrite

conInsert.Open "a vilid connect string"

Set cmdChange = New ADODB.Command
Set cmdChange.ActiveConnection = conInsert

cmdChange.CommandType = adCmdText

cmdChange.CommandText = "INSERT INTO STD_NEW_RECORD (
STD_ID, STD_NAME, STD_CLASS.....
SELECT
STD_ID, OLD_STD_NAME..
FROM OLD_STD_RECORD WHERE
STD_ID like '000%'" <= problem is here

cmdChange.Execute
-------------------------------------------------

The above statements insert the old student record table into a new student record table. STD_ID is char(12) and the primary key of both table

I use the "STD_ID like '000%'" to limit the number of record insert into the new student table. By change the condition, i can roughly limit the number of record insert into the new student table

When the the number of record is about 8000, the program run correctly, but when I delete condition "STD_ID like '000%'", about 100000 record will insert into the new student record table, the VB program crash.

the message just said some memory location is not allow to read.

Would anyone help me solve this problem?

THANKS
Reply With Quote
  #2 (permalink)  
Old 10-16-03, 16:56
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
Re: (Problem) Insert data error by VB6 with DB2 V7

Sounds like your just timing out..

Why not make this a stored procedure and call that...

It'll be compiled, and run more effeciently (well as effecient a scan is going to be)...

Really code of your logic as sprocs and leave the presentation to vb...
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On