Problems with data conversion from SQL ServerDB -

Results 1 to 2 of 2

Thread: Problems with data conversion from SQL ServerDB -

  1. #1
    Join Date
    Dec 1969

    Default Problems with data conversion from SQL ServerDB -

    I have a credit application ASP page that sends the inputs to 4 DB tables. The first one inserts values into the customers table<BR>automatically generating an autonumber. I then created a variable to hold another select that will retrieve this autonumber(custid). I then want to use this variable that is holding the custid into another table. <BR><BR>The problem is that I can get this far:<BR><BR>custidX = "SELECT MAX(custid) FROM Customers"<BR><BR>But when i try and use the variable custidX for my next insert I get type mismatch errors. I know that this is supposed to happen because my variable is a string, but i cannot get any code to work to set the value of the variable to type int. I have tried to CONVERT it and also CAST. Please help me!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: You never executed it!

    When you state:<BR>custidX = "SELECT MAX(custid) FROM Customers"<BR><BR>you are saying the variable &#039custidX&#039 is equal to text &#039select....&#039<BR>To get the actual number, try this:<BR>set rsCustID=conn.execute("select max(custid) as foo from Customers"<BR>custidX=rsCustID("foo")<BR><BR>This will set custidX to the variable.<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