MS Access and ASP.net application
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.
Mar 07, 2008 |
Computers & Internet