473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

adding a value to a string

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

Nov 19 '05 #1
1 975
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.
<am*******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: James Geurts | last post by:
Hey all... I posted this in the vs.net ide group too, but people are not answering, so I figured that it might be more appropriate here. I'm not sure if I'm adding a designer to my code properly. ...
9
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
6
by: cpnet | last post by:
I've authored a custom web component (a non-ui component kinda like a DataSet) and so far it's working. When my web component is added to the web form in the designer from the toolbox, the...
0
by: Adam J. Schaff | last post by:
Hello. I have a custom collection that implements IBindingList (allownew and allowremove are both true). I have bound it to a datagrid. I have add and remove buttons on the screen. I want to...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
5
by: Water Cooler v2 | last post by:
I know that we can add a single name value entry in app.config or web.config in the configuration/configSettings/appSettings section like so: <add key="key" value="value" /> Question: I want...
0
by: =?Utf-8?B?QW5keSBZdQ==?= | last post by:
Hi, I'm trying to return exceptions from a WCF Service using FaultExceptions. I got the service compiled and running. But I get an error while adding a service reference to it. The error reads: "...
1
damonreid
by: damonreid | last post by:
Access 2003 Microsoft Windows XP Pro Hey, I am currently pulling my hair out here. I have a Form for adding new projects to a database, the only problem is that when I close the form it doesn't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.