Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 23, 2007 02:18 AM by mbanavige
Member
69 Points
62 Posts
Mar 23, 2007 01:36 AM|LINK
Hello
I have a textbox and button on my webform. I have a field in the database with data type integer and allowing null value to be entered.
But when user keeps the textbox blank and clicks the button, its giving me following error:
Incorrect Syntax near ','
But when user enters some value its inserting. How to solve it?
Rathish
All-Star
134971 Points
15423 Posts
ASPInsiders
Moderator
MVP
Mar 23, 2007 02:18 AM|LINK
Empty Textboxes are not null values. They contain an empty string. So you are actually trying to insert an empty string into your integer column .
You could check your Textbox.Text property and if it's an empty string you would instead substitute DbNullValue for your insert.
rathish_pill...
Member
69 Points
62 Posts
Error inserting blank value
Mar 23, 2007 01:36 AM|LINK
Hello
I have a textbox and button on my webform. I have a field in the database with data type integer and allowing null value to be entered.
But when user keeps the textbox blank and clicks the button, its giving me following error:
Incorrect Syntax near ','
But when user enters some value its inserting. How to solve it?
Rathish
mbanavige
All-Star
134971 Points
15423 Posts
ASPInsiders
Moderator
MVP
Re: Error inserting blank value
Mar 23, 2007 02:18 AM|LINK
Empty Textboxes are not null values. They contain an empty string. So you are actually trying to insert an empty string into your integer column .
You could check your Textbox.Text property and if it's an empty string you would instead substitute DbNullValue for your insert.