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 > Informix > Informix table insert from VB6

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-03, 15:43
gsmithriv gsmithriv is offline
Registered User
 
Join Date: Jul 2003
Posts: 5
Informix table insert from VB6

Question...

I am inserting a record into an Informix table. One of the
values I insert is 0 (zero) into a serial field. What I was hoping
someone could answer is how can I retrieve the value of the
serial field after the insert from the VB6 program?
Reply With Quote
  #2 (permalink)  
Old 08-10-03, 01:53
coleas coleas is offline
Registered User
 
Join Date: Jul 2003
Posts: 2
use DBINFO
Reply With Quote
  #3 (permalink)  
Old 08-12-03, 04:24
lloydnwo lloydnwo is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 262
Re: Informix table insert from VB6

Quote:
Originally posted by gsmithriv
Question...

I am inserting a record into an Informix table. One of the
values I insert is 0 (zero) into a serial field. What I was hoping
someone could answer is how can I retrieve the value of the
serial field after the insert from the VB6 program?
Hi there,

check the value of sqlca.sqlerrd[2] variable. This is an informix sqlca structure. All serial value assigned to the column are stored here.

Regards,

lloyd
Reply With Quote
  #4 (permalink)  
Old 08-12-03, 12:08
gsmithriv gsmithriv is offline
Registered User
 
Join Date: Jul 2003
Posts: 5
Informix table insert from VB6

Thank you for the help... really appreciated.

Is it possible to access the sqlca record from within VB?
Reply With Quote
  #5 (permalink)  
Old 08-13-03, 00:03
lloydnwo lloydnwo is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 262
Re: Informix table insert from VB6

Quote:
Originally posted by gsmithriv
Thank you for the help... really appreciated.

Is it possible to access the sqlca record from within VB?
Your welcome, I am not too sure whether we can access sqlca record from VB, maybe u can try.
Reply With Quote
  #6 (permalink)  
Old 03-07-04, 00:17
pigalle pigalle is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
use the following code.... works for me

declare the following function

Public Function GetSerialNum() As Long
Dim strSerial As String, rs_serial As New ADODB.Recordset
strSerial = "SELECT DBINFO(""SQLCA.SQLERRD1"") FROM ST_COMPANY" (to get single return)
CreateRecordset cnnDB, rs_serial, strSerial
GetSerialNum = rs_serial(0)
rs_serial.Close
End Function

then to use the function try the following

strSql = "INSERT INTO ps_end_of_day VALUES(0, " & BranchID & ", '" & Format(Date, "ddmmyyyy") & "', '" & Format(Time, "hh:mm") & "', " & UserId & ")"
cnnDB.Execute strSql
end_serial_num = GetSerialNum

works fine

regards
john
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