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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Typecasting: String to Int

Status
Not open for further replies.

dashen

Programmer
Jul 14, 2005
233
US
I wrote a stand alone program in VB6 that pulls data from SQL Server 2000.

I used a Listview Item to store metadata like a number to update and delete selected items.

The problem is, I made an update last week that has corrupted the system in some way that I cannot figure out. It is driveing me nuts.

In the ListView the integer values are stared as strings. And I get this error

Run-time error '-2147217913 (80040e07)':
Syntax error converting the varchar value '*' to a column of data type int


The actual number is 114. Is '*' ascii for 114?

Any chance any of you can help? Thanks. This program is crucial because it is work for a major system.
 
I used CInt(and the String variable)

and it still gives me that error.
 
Figured it out. It wasn't a front end problem.
 
do you want to update the table with the values in your listview?
if so, avoid using special characters like single quote (') or asterisk (*) because they are sql server constant chars.

hope this helps.

ynad
----
It is foolish to listen to someone who will not listen to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top