Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Informix oledb drivers


Message #1 by "lewis bass" <lewis@t...> on Wed, 5 Jun 2002 22:38:31
I have an Informix table that contains a serial key.

After inserting a record into the table i need to get the serial key 
returned back to my .net web site? The key is needed to do further 
processing, and to link child records to the parent.

The Informix-4gl code would do it something like this

insert into transaction values (0,1,2)
serialkey = sqlca.sqlerrd[2]

Has anyone tried anything like this?

Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Thu, 6 Jun 2002 09:23:59 -0400
Lewis,

	Try something like this, using the OleDbCommand class
(yourConnection is a valid OleDbConnection object):

---
OleDbCommand insert = new OleDbCommand(
	"INSERT INTO transaction VALUES (0, 1, 2)\n" +
	" serialkey = sqlca.sqlerrd[2]", yourConnection);
insert.CommandType = CommandType.Text;
OleDbParameter return = 
	insert.Parameters.Add("serialkey", OleDbType.Integer);
return.Direction = ParameterDirection.ReturnValue;
// execute the command
insert.ExecuteNonQuery();
// connection must be closed to get the return value
yourConnection.Close();
Console.WriteLine(
	"Returned: {0}.\n", 
	insert.Parameters["serialkey"].Value);
---

	If that doesn't work, try messing around and tweaking the code a bit
more.

HTH,
- Chuck	

-----Original Message-----
From: lewis bass [mailto:lewis@t...]
Sent: Wednesday, June 05, 2002 6:39 PM
To: ASP+
Subject: [aspx] Informix oledb drivers


I have an Informix table that contains a serial key.

After inserting a record into the table i need to get the serial key 
returned back to my .net web site? The key is needed to do further 
processing, and to link child records to the parent.

The Informix-4gl code would do it something like this

insert into transaction values (0,1,2)
serialkey = sqlca.sqlerrd[2]

Has anyone tried anything like this?


  Return to Index