Last value entered (i read the faqs...)

Results 1 to 2 of 2

Thread: Last value entered (i read the faqs...)

  1. #1
    Join Date
    Dec 1969

    Default Last value entered (i read the faqs...)

    I have read the FAQ, but I am getting my recordset a little differently, I am just wondering if I am going to run into any problems with this methodology for getting the record last inserted. Thanks for looking<BR><BR>Public Sub CreateOrder(sFileNum,iUserID,sLenderName,iBrokerID ,dDateCreated,dClosingDate,iFileTypeID,iLeadTimeID )<BR>Dim sSQL<BR> sSQL = "INSERT INTO FileNumber (File_Number,User_ID,Lender_Name,Broker_ID,Date_Cr eated,Closing_Date,File_Type,Lead_Time_ID)" & _<BR> " VALUES (&#039;" & sFileNum & "&#039;" & _<BR> "," & iUserID & _<BR> ",&#039;" & sLenderName & "&#039;" & _<BR> "," & iBrokerID & _ <BR> ",&#039;" & dDateCreated & "&#039;" & _<BR> ",&#039;" & dClosingDate & "&#039;" & _<BR> "," & iFileTypeID & _<BR> "," & iLeadTimeID & ");"<BR> <BR> ExecuteSQL sSQL<BR> Set oRs = GetRecordsetDynamic("SELECT @@Identity")<BR> new_id = oRs(0)<BR>End Sub

  2. #2
    Join Date
    Dec 1969

    Default And what, pray tell,

    does "GetRecordsetDynamic" do?<BR><BR>And why would you use it for something as blindingly simple as this, in any case?<BR><BR>If you just replace your line<BR> Set oRs = GetRecordsetDynamic("SELECT @@Identity")<BR>with <BR> Set oRs = yourConn.Execute("SELECT @@Identity")<BR>you&#039;d<BR> (a) save the overhead of yet another VBScript function call<BR> (b) know that the code would work<BR><BR>Of course, I can say the same about your use of<BR> ExecuteSQL sSQL<BR>in place of<BR> yourConn.Execute sSQL<BR><BR>I simply do *NOT* understand the point of using functions and subs that don&#039;t contribute to (a) performance, (b) readability, (c) error handling.<BR><BR>If yours *do* error handling, then maybe I take it all back. <BR><BR>But in any case, how can we tell without seeing the code for those functions and subs???<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts