|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
inserting problem
Hello, I am having a problem with inserting a value into a table. Here is my code:
sql = "INSERT INTO AnthonyInbox (MessageID, Sender, Subject, Message, Date)"+ "VALUES('" + msgNum + "','" + from + "','" + subject + "','" + mainMsg + "','" + date + " ')"; cmd = new SqlCommand(sql, con); cmd.ExecuteNonQuery(); msgNum, from, subject, and date are succesfully entered in the table, but mainMsg is blank in the table. I have check that mainMsg contains some string, but for some reasons won't enter the value in the table. Below is the definition of the table: MessageID varchar 50 Sender varchar 50 Subject varchar 200 Message varchar 8000 Date varchar 50 PLEASE help me |
|
#2
|
||||
|
||||
|
the size may be causing problems, try using a sqlparameter for mainmsg
PHP Code:
Personaly i would also like to advise that whenever you need a string longer than 255 in your db to not use varchar but the text type instead, it's a far more efficiant and safer for storing such huge datachunks. It should also increase performance. Last edited by Kris_Vanherck : March 17th, 2004 at 04:19 AM. Reason: formating |
|
#3
|
|||
|
|||
|
thAnK YoU
Kris,
thank you so very much for your help. I am new with SQL server, so I need a lot of advice I think I want to try your idea to use text data type instead. Thanks again Irma |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > inserting problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|