|
-
Nov 20th, 2006, 04:39 AM
#1
Thread Starter
Addicted Member
[RESOLVED] inserting into database
i am using a normal inert into statement to insert the data into the access database but theree are some cases in which i need to leave the text box blank then the insert statement gives error can u tell me the method of inserting a blank value that is if the text box has the value that is inserted else blank is inserted
Using VB.NET 2003/.NET 1.1
If you found a post useful then please Rate it!
Please mark you thread resolved using the Thread Tools above
-
Nov 20th, 2006, 04:45 AM
#2
Addicted Member
Re: inserting into database
What error ? AFAIK, textbox will have an empty string if you don't input anything. So, there should be no problem if you leave a textbox empty, unless the field that you want to insert is a primary key.
-
Nov 20th, 2006, 05:07 AM
#3
Thread Starter
Addicted Member
Re: inserting into database
i dont know wats happening but if i leave any of the text box empty then there is an error data type mismatch else it is ok
Using VB.NET 2003/.NET 1.1
If you found a post useful then please Rate it!
Please mark you thread resolved using the Thread Tools above
-
Nov 20th, 2006, 05:55 AM
#4
Thread Starter
Addicted Member
Re: inserting into database
Using VB.NET 2003/.NET 1.1
If you found a post useful then please Rate it!
Please mark you thread resolved using the Thread Tools above
-
Nov 20th, 2006, 10:13 AM
#5
Fanatic Member
Re: inserting into database
Well that would suggest the fields don't allow Null values, for one. For two, are you opening the connection before sending the data?
Warren Ayen
Senior C# Developer
DLS Software Studios ( http://www.dlssoftwarestudios.com/)
I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
Hey! If you like my post, or I solve your issue, please Rate Me!
-
Nov 20th, 2006, 10:14 AM
#6
Re: inserting into database
If the fields in your access table do not allow null, then you can't insert a null value to it.... So you need to find out the specs for that table, things like field names and data types, allows null or not.... If any field that does not allow null, then you have to supply a default value for that field.
-
Nov 20th, 2006, 11:33 AM
#7
Junior Member
Re: inserting into database
You could set the value of the textbox to a space (" ") if nothing is input, and this would keep you from having to change the null state on the field, if you are hesitant to do that.
Hope this helps,
Brian Swanson
-
Nov 20th, 2006, 12:10 PM
#8
Re: inserting into database
 Originally Posted by purpleant
You could set the value of the textbox to a space (" ") if nothing is input, and this would keep you from having to change the null state on the field, if you are hesitant to do that.
Hope this helps,
Brian Swanson
This works only if that field's data type is string... What if the field is numeric or date?
-
Nov 20th, 2006, 01:59 PM
#9
Junior Member
Re: inserting into database
I figured it was a safe assumption based on the fact that a textbox was being used and the question being asked that it was a string.
-
Nov 21st, 2006, 05:16 AM
#10
New Member
Re: inserting into database
 Originally Posted by elixir_5000
i am using a normal inert into statement to insert the data into the access database but theree are some cases in which i need to leave the text box blank then the insert statement gives error can u tell me the method of inserting a blank value that is if the text box has the value that is inserted else blank is inserted
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|