adding a value to a string

  • Thread starter Thread starter amitbadgi
  • Start date Start date
A

amitbadgi

Hi guys, I wanted to knwo if it was possible to add a value to a
string, I have a field in my access table case_no which is of type
TEXT, and want to add a value, here is teh code,

Dim rs


rs = conn.Execute("SELECT MAX(case_no) AS num FROM tblEvent WHERE
LEFT(case_no, 4) = '" & TEMP & "' ")


'IF IT's NULL THEN MAKE IT = 1
if
(trim(convert.tostring(rs("num"))))="0" then
case_no = TEMP & "00001"
else
rs.Movefirst
case_no =trim(convert.tostring(rs("num")))
Response.Write (trim(convert.tostring(rs("num"))) & "<br>")
case_no = case_no+ 1
response.Write(case_no)

end if
rs.close


Now even if i change case_no to a number, it doesnt work , I am not
sure as to how to proceed, i am converting this asp app to asp.net. Any
help is appreciated.
PS: I tried posting the same topic but couldnt go thru , henc eif this
repeats, I apologise
 
Some general comments:
1) turn Option Strict On
2) Use ADO.NET instead of ADO
3) Instead of saying 'it doesn't work', in future posts please say exactly
what you expect to happen, and exactly what does happen, including all error
messages, etc.

You can't add a number to a string together. It doesn't make sense. You can
concatenate 2 strings, or you can add two numbers.

If case_no was declared as an integer, and you added 1 to it, that would
work. However, you are assigning case_no to TEMP, and we can't tell what
that is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top