How do I pull a value????

Results 1 to 3 of 3

Thread: How do I pull a value????

  1. #1
    Join Date
    Dec 1969

    Default How do I pull a value????

    I have need to do a select on a field that was already inserted. That is I have inserted a bus_id and Fein into a table and now to get a registration number we have built a function that trims the fein and adds a part of the bus_id to it. The problem I have is I need to do a select to get the new registration number and my sytax I don&#039;t think is right.<BR><BR>&#039;Get the next Business number from the GeneratedUniquenbr table<BR>sql2="select distinct next_gun() as fred " & _<BR> "From dummy "<BR><BR>set rs2=cnn.Execute(sql2)<BR><BR>&#039;Insert the following record into the Business table. Business_Id is coming from<BR>&#039; the next_gun function above.<BR><BR>sql= "INSERT INTO Business(Business_Id, Fein, Business_Name, Business_Type, " & _<BR> "Desc_Of_Business, Business_Start_Date, " & _<BR> "Business_Start_Date_In_Area, Business_End_Date, Business_End_Reason_Code )"<BR> <BR>sql=sql & "Values( "<BR>sql=sql & rs2("fred")<BR>sql=sql & "," & "&#039;" & request ("Fein") & "&#039;"<BR>sql=sql & "," & "&#039;" & Replace(Request("Business_Name"),"&#039;","&#039;& #039;") & "&#039;"<BR>sql=sql & "," & "&#039;" & request ("Business_Type") & "&#039;"<BR>sql=sql & "," & "&#039;" & Replace(Request("Desc_Of_Business"),"&#039;","&#03 9;&#039;") & "&#039;"<BR>sql=sql & "," & "convert(datetime,&#039;" & Request ("Business_Start_Date") &"&#039;, 101)"<BR>sql=sql & "," & "convert(datetime, &#039;" & Request ("Business_Start_Date_In_Area")& "&#039;, 101)"<BR>sql=sql & "," & "convert(datetime, &#039;" & Request ("Business_End_Date")& "&#039;, 101)"<BR>sql=sql & "," & "&#039;" & request ("Business_End_Reason_Code") & "&#039;"<BR>sql=sql & ")" <BR><BR>&#039;Response.Write sql<BR>set rs=cnn.Execute(sql)<BR><BR><BR>******************* ***** and then here is the problem ****** <BR>sql="Select next_reg(rs2("fred"), &#039;B&#039;) as regnum<BR> "from dummy "<BR><BR>set rs5=cnn.Execute(sql)<BR><BR>How Can I get a field inside a select? Sorry for the confusing question. It&#039;s tooooo confusing to me as well. Our DBA should be shot!!!<BR>

  2. #2
    Join Date
    Dec 1969

    Default Read this. SIMPLE FOR SOMEONE..........HELPPPP....

    How do I do a select with a previous field value. I need to do this <BR>sql= "Select next_reg(rs("Fein"), &#039;B&#039;) as Regnum "<BR> "from dummy "<BR> <BR>set rs9=cnn.Execute(sql)<BR><BR>The rs(fein) is a value the user inputted and has been added to another table above with a insert. In the db if I do a select with (44444444, &#039;B&#039;) as Regnum it gives me the next generated number. So what syntax do I need to use to have rs(fein) be seen as what the user put in 44444444? Thank you for the help..

  3. #3
    <eop> Guest

    Default Use the object value, not recordset value...


Posting Permissions

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