ASP Form variable Passing

Results 1 to 2 of 2

Thread: ASP Form variable Passing

  1. #1
    Join Date
    Dec 1969

    Default ASP Form variable Passing

    I am facing problem in the following code<BR><BR>&#060;FORM ACTION ="show_request.asp" Method = "POST"&#062;<BR>&#060;INPUT TYPE = "TEXT" NAME ="XYZ"&#062;<BR>&#060;INPUT TYPE = "TEXT" NAME ="XYZ"&#062;<BR><BR>&#060;/FORM&#062;<BR><BR>Request.Form ("XYZ") in our asp code in show_request.asp will return a string 1271,1270 (values put by user)<BR><BR>These values are used to process the form and results in output after connecting to database.<BR><BR>However the database designed requires XYZ Values in INT format and therefore throws an error as given below.<BR><BR>Error MESSAGE:<BR><BR>[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value &#039;1271, 1270&#039; to a column of data type int.<BR><BR>How can i post the data in int form so the value of xyz is passed one by one as 1271<BR> and 1270<BR><BR>Please mail solution to me on<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP Form variable Passing

    One method you could use is to to split the value of r.f("xyz") on the comma, and then apply the cint() function to both of them.<BR><BR>by splitting them, you place them in an array, you are then able to reference them by their location in the array, and perform further processing on them.<BR><BR>myArray = split(Request.Form("xyz"), ",")<BR> for myNumber = 0 to Ubound(myArray)<BR> cInt(myArray(myNumber))<BR> Next<BR>...<BR>then do the processing for the db based upon the values of myArray(myNumber)<BR><BR>the code may not be perfect, but it should help to give you an idea of how you can go about doing it

Posting Permissions

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