Question about Business & Productivity Software
How to insert the data in the database from a .net application. i'm using c# as code behind language n getting problems while inserting text fields,number fields are getting inserted without any problem.
Please help me.
Thanks in advance.
You probably need to be inserting the value of a text object (ie, a String) , not the object itself. In VB.NET, a String object is an actual, not unlike a Java String object. In "classic" VB, a String object isn't really handled by the interpreter as an object in the C# / Java sense, so it can be referred to directly without resolving the value via a method call. So attempting to insert an object reference into a database field from C# code will probably not work unless the database knows to call toSting() on the object, which I am 99.99999% sure it cannot (depends on the database-- in this case Access, and more particularly, what version you are using, and if there is any .NET framework interoperability).
Calling myString.toString() though returns a String object in C#, so using that is likely not going to work. What you may need to do is return a character array using the 'chars' and 'length' properties of the C# String object.
Finally, after all this, your problem could be a lot simpler: the value(s) you are trying to insert may not be right for the field-- check the length of the values being inserted, etc. Use .trim() to eliminate leading and trailing whitespace, for example. If you post your INSERT statement and an example of the data you are using, I may be able to tell you more. Also, you are in ASP.NET and data transfer from web containers to Access databases is notoriously bedeviled work.
Posted on Mar 07, 2008
Tips for a great answer:
Feb 05, 2015 | Microsoft Office Professional 2007 Full...
Mar 09, 2010 | Microsoft Office Standard for PC
Sep 21, 2009 | Microsoft Office Standard for PC
Oct 18, 2008 | Microsoft Office 2003 Basic Edition...
Mar 18, 2008 | Microsoft Word 2000 for PC
Sep 26, 2007 | Microsoft Office Standard for PC
202 people viewed this question
Usually answered in minutes!