Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

character clipping problem 2

Status
Not open for further replies.

btween

Programmer
Aug 7, 2003
338
0
0
US
I have a page that enters received post values into an ms sql database. The problem is that I get some number like 000450 and upon insertion it is truncated to 450.
I have my db field set as nvarchar 50

this is my update sql:

strUpdate="Update Orders SET PaymentStatus=" & CODE & " WHERE OrderID=" & ORDERID

how can I maintain all 6 numbers in the database?

thanks
 
Try to put parentheses around your variable so that it will accept a string value.
Code:
strUpdate="Update Orders SET PaymentStatus=[COLOR=red]'[/color]" & CODE & "[COLOR=red]'[/color] WHERE OrderID=" & ORDERID

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
try inserting quote marks around your value so that the SQL statement recognizes it as a string...

Code:
strUpdate="Update Orders SET PaymentStatus=[red]'[/red]" & CODE & "[red]'[/red] WHERE OrderID=" & ORDERID



Earnie Eng
 
haha... I guess you clicked the submit a few seconds faster than I...

Earnie Eng
 
Even in my old age, I guess I can still type when I need to... ;-)

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Am I the only one that noticed that while Chipstick was faster he typed:

Try to put parentheses around your variable so that it will accept a string value.

heh.. I guess your old age is showing! lol
 
Curious, though... in access, if you attempt that SQL statement, it would error out due to wrong data type passed. Is there some characeristic of the nvarchar that allows it to accept both numbers and strings?

Earnie Eng
 
pkailas: I suppose I've been called worse than Chipstick... [lol]

ahmun: What data type are you using in Access? I would think that a text data type would accept it with no problem.

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Chopstik, perhaps I'm even older than you? lol

Who cares if ahmun has problems with access.. the question was concerning MS SQL. off topic, bad boy!
 
It was more a matter of principle... if you are passing values to something of datatype string, shouldn't you make sure your query string also included the quotes? likewise, no quotes if it is a number?

Earnie Eng
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top