Answered by:
Input string was not in a correct format- autonumber as primary ID

Question
-
User-911157248 posted
Ther error: Input string was not in a correct format- keeps popping up when I do an update on access table.
Since the autonumber is a "number" my var (theID)should be an integer? my code:
AccessDataSource1.UpdateCommand = "update customers set title= @tb2,pdate=@thisdate,state=@dd1,description=@tb3,location =@tb4 where custID = "
+ theIDThursday, March 10, 2011 12:55 PM
Answers
-
User-1199946673 posted
Can you please explain why you're using parameters for the values, but not in the WHERE clause?
update customers set title= @tb2,pdate=@thisdate,state=@dd1,description=@tb3,location=@tb4 where custID=@custID
And then provide an extra parameter....
But when you want to do it your way i think the solution is:
+ theID.ToString()
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, March 10, 2011 1:30 PM
All replies
-
User1983249378 posted
There is a little mishap , put single qotes in theID like
AccessDataSource1.UpdateCommand = "update customers set title= @tb2,pdate=@thisdate,state=@dd1,description=@tb3,location =@tb4 where custID =' "
+ theID + "'"Thursday, March 10, 2011 1:03 PM -
User-911157248 posted
wouldn't that make it a string. I have to keep it integer to match autonumber I thought?
Thursday, March 10, 2011 1:06 PM -
User-577741185 posted
Use where custID = " & theID
Thursday, March 10, 2011 1:15 PM -
User-1199946673 posted
Can you please explain why you're using parameters for the values, but not in the WHERE clause?
update customers set title= @tb2,pdate=@thisdate,state=@dd1,description=@tb3,location=@tb4 where custID=@custID
And then provide an extra parameter....
But when you want to do it your way i think the solution is:
+ theID.ToString()
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, March 10, 2011 1:30 PM -
User1983249378 posted
If any of the above posts resolved your problem mark it as answer
hans_v is correct , u can also take parameter for your custID
Friday, March 11, 2011 6:03 AM -
User-911157248 posted
Yes, all set now. The issue I was having was session var issue with custID. I do use parameters!
Friday, March 11, 2011 1:24 PM