473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get a identity back

Not sure if you need more here, but I am sending all these values in an
object. I am not sure how to get the Identity back from the SP using an
object like this
Public Shared Sub PacketSave(ByVal packet As PacketBO)

Dim p() As Object = New Object() {packet.EnteredUserID,
packet.OfferingCompany, packet.CompanyName, _

packet.InstallAddress.Address1, packet.InstallAddress.City,
packet.InstallAddress.State, _

packet.InstallAddress.Zip, packet.InstallAddress.Township,
packet.InstallAddress.ContactName, _

packet.InstallAddress.ContactPhone, packet.InstallAddress.ContactFax,
packet.InstallAddress.ContactEmail, _

packet.InstallAddress.County, packet.BillingAddress.Address1,
packet.BillingAddress.City, _

packet.BillingAddress.State, packet.BillingAddress.Zip,
packet.BillingAddress.Township, _

packet.BillingAddress.ContactName, packet.BillingAddress.ContactPhone,
packet.BillingAddress.ContactFax, _

packet.BillingAddress.ContactEmail, packet.TaxUCC, packet.FederalSaleTax,
packet.StateSaleTax, _

packet.StateGRSurcharge, packet.County911Cost, packet.VoiceSaleName,
packet.DataSaleName, _

packet.HowCustomerHear, packet.TypeOfService, packet.EngineerRequired,
packet.DeliveryArea, _

packet.RequestedInstallDate, packet.RequestedTime, packet.LOADate,
packet.PacketDate, _

packet.SaleDate, packet.AccountRepUserID, packet.AccountRepName,
packet.AccountRepAddress.ContactPhone, _

packet.InstallAddress.ContactFax, packet.InstallAddress.ContactEmail,
packet.AuthorizedExcutiveUserID, _

packet.AuthorizedExcutiveName, packet.AuthorizedExecutiveInfo,
packet.PhoneSystemVendor, packet.PhoneNumber, packet.IsThisRenewal, _

packet.TermContract}

Proxy.ExecuteNonQuery("usp_Packet_ins", p)

End Sub



CREATE PROCEDURE usp_Packet_ins
(@EnteredUserID_2 [int],
@OfferingCompany_4 [varchar](100),
@CompanyName_5 [varchar](100),
@InstallAddress_6 [varchar](50),
@InstallCity_7 [varchar](50),
@InstallState_8 [varchar](2),
@InstallZip_9 [varchar](10),
@InstallTownship_10 [varchar](50),
@InstallContactName_11 [varchar](50),
@InstallContactPhone_12 [varchar](20),
@InstallContactFax_13 [varchar](20),
@InstallContactEmail_14 [varchar](100),
@InstallCounty_15 [varchar](50),
@BillingAddress_16 [varchar](50),
@BillingCity_17 [varchar](50),
@BillingState_18 [varchar](2),
@BillingZip_19 [varchar](10),
@BillingTownship_20 [varchar](50),
@BillingContactName_21 [varchar](50),
@BillingContactPhone_22 [varchar](20),
@BillingContactFax_23 [varchar](20),
@BillingContactEmail_24 [varchar](100),
@TaxUCC_25 float,
@FederalSaleTax_26 float,
@StateSaleTax_27 float,
@StateGRSurcharge_28 float,
@County911Cost_29 float,
@VoiceSaleName_30 [varchar](50),
@DataSaleName_31 [varchar](50),
@HowCustomerHear_32 [varchar](50),
@TypeOfService_33 [varchar](50),
@EngineerRequired_34 [varchar](50),
@DeliveryArea_35 [varchar](50),
@RequestedInstallDate_36 [datetime],
@RequestedTime_37 [varchar](50),
@LOADate_38 [datetime],
@ProposalDate_39 [datetime],
@SaleDate_40 [datetime],
@AccountRepUserID_41 [int],
@AccountRepName_42 [varchar](50),
@AccountRepPhone_43 [varchar](20),
@AccountRepFax_44 [varchar](20),
@AccountRepEmail_45 [varchar](50),
@AuthorizedExcutiveUserID_46 [int],
@AuthorizedExcutiveName_47 [varchar](50),
@AuthorizedExecutiveInfo_48 [varchar](50),
@PhoneSystemVendor_49 [varchar](50),
@PhoneNumber_50 [varchar](50),
@IsThisRenewal_51 [tinyint],
@TermContract_52 [varchar](50),
@Identity int OUTPUT)

AS INSERT INTO [SaleProposal].[dbo].[tblPacket]
([EnteredUserID],
[EnteredDate],
[OfferingCompany],
[CompanyName],
[InstallAddress],
[InstallCity],
[InstallState],
[InstallZip],
[InstallTownship],
[InstallContactName],
[InstallContactPhone],
[InstallContactFax],
[InstallContactEmail],
[InstallCounty],
[BillingAddress],
[BillingCity],
[BillingState],
[BillingZip],
[BillingTownship],
[BillingContactName],
[BillingContactPhone],
[BillingContactFax],
[BillingContactEmail],
[TaxUCC],
[FederalSaleTax],
[StateSaleTax],
[StateGRSurcharge],
[County911Cost],
[VoiceSaleName],
[DataSaleName],
[HowCustomerHear],
[TypeOfService],
[EngineerRequired],
[DeliveryArea],
[RequestedInstallDate],
[RequestedTime],
[LOADate],
[ProposalDate],
[SaleDate],
[AccountRepUserID],
[AccountRepName],
[AccountRepPhone],
[AccountRepFax],
[AccountRepEmail],
[AuthorizedExcutiveUserID],
[AuthorizedExcutiveName],
[AuthorizedExecutiveInfo],
[PhoneSystemVendor],
[PhoneNumber],
[IsThisRenewal],
[TermContract])

VALUES
( @EnteredUserID_2,
GETDATE(),
@OfferingCompany_4,
@CompanyName_5,
@InstallAddress_6,
@InstallCity_7,
@InstallState_8,
@InstallZip_9,
@InstallTownship_10,
@InstallContactName_11,
@InstallContactPhone_12,
@InstallContactFax_13,
@InstallContactEmail_14,
@InstallCounty_15,
@BillingAddress_16,
@BillingCity_17,
@BillingState_18,
@BillingZip_19,
@BillingTownship_20,
@BillingContactName_21,
@BillingContactPhone_22,
@BillingContactFax_23,
@BillingContactEmail_24,
@TaxUCC_25,
@FederalSaleTax_26,
@StateSaleTax_27,
@StateGRSurcharge_28,
@County911Cost_29,
@VoiceSaleName_30,
@DataSaleName_31,
@HowCustomerHear_32,
@TypeOfService_33,
@EngineerRequired_34,
@DeliveryArea_35,
@RequestedInstallDate_36,
@RequestedTime_37,
@LOADate_38,
@ProposalDate_39,
@SaleDate_40,
@AccountRepUserID_41,
@AccountRepName_42,
@AccountRepPhone_43,
@AccountRepFax_44,
@AccountRepEmail_45,
@AuthorizedExcutiveUserID_46,
@AuthorizedExcutiveName_47,
@AuthorizedExecutiveInfo_48,
@PhoneSystemVendor_49,
@PhoneNumber_50,
@IsThisRenewal_51,
@TermContract_52)
SET @Identity = SCOPE_IDENTITY()
GO
Nov 19 '05 #1
1 980
The simpliest way is to remove @Identity from the list of parameters and
return it with a select statement:

select @Identity

Then you can read it as

(int) Proxy.ExecuteScalar ()

Eliyahu

"Dave" <da***@helixpoint.com> wrote in message
news:uh**************@TK2MSFTNGP12.phx.gbl...
Not sure if you need more here, but I am sending all these values in an
object. I am not sure how to get the Identity back from the SP using an
object like this
Public Shared Sub PacketSave(ByVal packet As PacketBO)

Dim p() As Object = New Object() {packet.EnteredUserID,
packet.OfferingCompany, packet.CompanyName, _

packet.InstallAddress.Address1, packet.InstallAddress.City,
packet.InstallAddress.State, _

packet.InstallAddress.Zip, packet.InstallAddress.Township,
packet.InstallAddress.ContactName, _

packet.InstallAddress.ContactPhone, packet.InstallAddress.ContactFax,
packet.InstallAddress.ContactEmail, _

packet.InstallAddress.County, packet.BillingAddress.Address1,
packet.BillingAddress.City, _

packet.BillingAddress.State, packet.BillingAddress.Zip,
packet.BillingAddress.Township, _

packet.BillingAddress.ContactName, packet.BillingAddress.ContactPhone,
packet.BillingAddress.ContactFax, _

packet.BillingAddress.ContactEmail, packet.TaxUCC, packet.FederalSaleTax,
packet.StateSaleTax, _

packet.StateGRSurcharge, packet.County911Cost, packet.VoiceSaleName,
packet.DataSaleName, _

packet.HowCustomerHear, packet.TypeOfService, packet.EngineerRequired,
packet.DeliveryArea, _

packet.RequestedInstallDate, packet.RequestedTime, packet.LOADate,
packet.PacketDate, _

packet.SaleDate, packet.AccountRepUserID, packet.AccountRepName,
packet.AccountRepAddress.ContactPhone, _

packet.InstallAddress.ContactFax, packet.InstallAddress.ContactEmail,
packet.AuthorizedExcutiveUserID, _

packet.AuthorizedExcutiveName, packet.AuthorizedExecutiveInfo,
packet.PhoneSystemVendor, packet.PhoneNumber, packet.IsThisRenewal, _

packet.TermContract}

Proxy.ExecuteNonQuery("usp_Packet_ins", p)

End Sub



CREATE PROCEDURE usp_Packet_ins
(@EnteredUserID_2 [int],
@OfferingCompany_4 [varchar](100),
@CompanyName_5 [varchar](100),
@InstallAddress_6 [varchar](50),
@InstallCity_7 [varchar](50),
@InstallState_8 [varchar](2),
@InstallZip_9 [varchar](10),
@InstallTownship_10 [varchar](50),
@InstallContactName_11 [varchar](50),
@InstallContactPhone_12 [varchar](20),
@InstallContactFax_13 [varchar](20),
@InstallContactEmail_14 [varchar](100),
@InstallCounty_15 [varchar](50),
@BillingAddress_16 [varchar](50),
@BillingCity_17 [varchar](50),
@BillingState_18 [varchar](2),
@BillingZip_19 [varchar](10),
@BillingTownship_20 [varchar](50),
@BillingContactName_21 [varchar](50),
@BillingContactPhone_22 [varchar](20),
@BillingContactFax_23 [varchar](20),
@BillingContactEmail_24 [varchar](100),
@TaxUCC_25 float,
@FederalSaleTax_26 float,
@StateSaleTax_27 float,
@StateGRSurcharge_28 float,
@County911Cost_29 float,
@VoiceSaleName_30 [varchar](50),
@DataSaleName_31 [varchar](50),
@HowCustomerHear_32 [varchar](50),
@TypeOfService_33 [varchar](50),
@EngineerRequired_34 [varchar](50),
@DeliveryArea_35 [varchar](50),
@RequestedInstallDate_36 [datetime],
@RequestedTime_37 [varchar](50),
@LOADate_38 [datetime],
@ProposalDate_39 [datetime],
@SaleDate_40 [datetime],
@AccountRepUserID_41 [int],
@AccountRepName_42 [varchar](50),
@AccountRepPhone_43 [varchar](20),
@AccountRepFax_44 [varchar](20),
@AccountRepEmail_45 [varchar](50),
@AuthorizedExcutiveUserID_46 [int],
@AuthorizedExcutiveName_47 [varchar](50),
@AuthorizedExecutiveInfo_48 [varchar](50),
@PhoneSystemVendor_49 [varchar](50),
@PhoneNumber_50 [varchar](50),
@IsThisRenewal_51 [tinyint],
@TermContract_52 [varchar](50),
@Identity int OUTPUT)

AS INSERT INTO [SaleProposal].[dbo].[tblPacket]
([EnteredUserID],
[EnteredDate],
[OfferingCompany],
[CompanyName],
[InstallAddress],
[InstallCity],
[InstallState],
[InstallZip],
[InstallTownship],
[InstallContactName],
[InstallContactPhone],
[InstallContactFax],
[InstallContactEmail],
[InstallCounty],
[BillingAddress],
[BillingCity],
[BillingState],
[BillingZip],
[BillingTownship],
[BillingContactName],
[BillingContactPhone],
[BillingContactFax],
[BillingContactEmail],
[TaxUCC],
[FederalSaleTax],
[StateSaleTax],
[StateGRSurcharge],
[County911Cost],
[VoiceSaleName],
[DataSaleName],
[HowCustomerHear],
[TypeOfService],
[EngineerRequired],
[DeliveryArea],
[RequestedInstallDate],
[RequestedTime],
[LOADate],
[ProposalDate],
[SaleDate],
[AccountRepUserID],
[AccountRepName],
[AccountRepPhone],
[AccountRepFax],
[AccountRepEmail],
[AuthorizedExcutiveUserID],
[AuthorizedExcutiveName],
[AuthorizedExecutiveInfo],
[PhoneSystemVendor],
[PhoneNumber],
[IsThisRenewal],
[TermContract])

VALUES
( @EnteredUserID_2,
GETDATE(),
@OfferingCompany_4,
@CompanyName_5,
@InstallAddress_6,
@InstallCity_7,
@InstallState_8,
@InstallZip_9,
@InstallTownship_10,
@InstallContactName_11,
@InstallContactPhone_12,
@InstallContactFax_13,
@InstallContactEmail_14,
@InstallCounty_15,
@BillingAddress_16,
@BillingCity_17,
@BillingState_18,
@BillingZip_19,
@BillingTownship_20,
@BillingContactName_21,
@BillingContactPhone_22,
@BillingContactFax_23,
@BillingContactEmail_24,
@TaxUCC_25,
@FederalSaleTax_26,
@StateSaleTax_27,
@StateGRSurcharge_28,
@County911Cost_29,
@VoiceSaleName_30,
@DataSaleName_31,
@HowCustomerHear_32,
@TypeOfService_33,
@EngineerRequired_34,
@DeliveryArea_35,
@RequestedInstallDate_36,
@RequestedTime_37,
@LOADate_38,
@ProposalDate_39,
@SaleDate_40,
@AccountRepUserID_41,
@AccountRepName_42,
@AccountRepPhone_43,
@AccountRepFax_44,
@AccountRepEmail_45,
@AuthorizedExcutiveUserID_46,
@AuthorizedExcutiveName_47,
@AuthorizedExecutiveInfo_48,
@PhoneSystemVendor_49,
@PhoneNumber_50,
@IsThisRenewal_51,
@TermContract_52)
SET @Identity = SCOPE_IDENTITY()
GO

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Ilija_G | last post by:
Hi, Is there any replace for "Select @@identity" that could return "just inserted" GUID as a primary key? Has anyone tested what's faster, working with Guid or Autonumber ?
2
by: Devesh Aggarwal | last post by:
Hi, I have a backup and restore module in my project. The backup uses a typed dataset object (XSD) to get the data from database and creates a xml file as the backup file (using the WriteXml...
17
by: Trevor Best | last post by:
I don't know if this has been reported before but it appears to be a bug with Access. If I create two tables both with an identity column then create an insert trigger on table1 that inserts a...
3
by: Justin | last post by:
I have created a dataset with two tables and an insert command, I need to be able to retreive the Key Identity after inserting into table "A" for use in table "B". Should I use ExecuteScalar()...
8
by: BigJohnson | last post by:
We're using ASPUpload as a tool to upload files to our server and save the details to SQLServer. However, I have an application where I need to return the pkID of the just saved file. I'm assuming...
41
by: pb648174 | last post by:
In a multi-user environment, I would like to get a list of Ids generated, similar to: declare @LastId int select @LastId = Max(Id) From TableMania INSERT INTO TableMania (ColumnA, ColumnB)...
3
by: Dave A | last post by:
Has anyone written or using an identity mapper design pattern in an enterprise framework? The identity mapper pattern is described in Martin Fowler's Patterns of Enterprise Application...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
11
by: stegze | last post by:
Hi All, I have a problem with a DB2 server of my customer. It is a Debian Linux running DB2 Express-C. I have an IDENTITY field as PK in a table and I use this value as FK in another table. Two...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.