How to put large text data (~20mb) into sql cs 3.5 database?
Posted
by Anindya Chatterjee
on Stack Overflow
See other posts from Stack Overflow
or by Anindya Chatterjee
Published on 2010-04-19T07:50:11Z
Indexed on
2010/04/19
7:53 UTC
Read the original article
Hit count: 341
I am using following query to insert some large text data :
internal static string InsertStorageItem =
"insert into Storage(FolderName, MessageId, MessageDate, StorageData) values ('{0}', '{1}', '{2}', @StorageData)";
and the code I am using to execute this query is as follows :
string content = "very very large data";
string query = string.Format(InsertStorageItem, "Inbox", "AXOGTRR1445/DSDS587444WEE", "4/19/2010 11:11:03 AM");
var command = new SqlCeCommand(query, _sqlConnection);
var paramData = command.Parameters.Add("@StorageData", System.Data.SqlDbType.NText);
paramData.Value = content;
paramData.SourceColumn = "StorageData";
command.ExecuteNonQuery();
But at the last line I am getting this following error :
System.Data.SqlServerCe.SqlCeException was unhandled by user code Message=The data was truncated while converting from one data type to another. [ Name of function(if known) = ] Source=SQL Server Compact ADO.NET Data Provider HResult=-2147467259 NativeError=25920 StackTrace: at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor) at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() at Chithi.Client.Exchange.ExchangeClient.SaveItem(Item item, Folder parentFolder) at Chithi.Client.Exchange.ExchangeClient.DownloadNewMails(Folder folder) at Chithi.Client.Exchange.ExchangeClient.SynchronizeParentChildFolder(WellKnownFolder wellknownFolder, Folder parentFolder) at Chithi.Client.Exchange.ExchangeClient.SynchronizeFolders() at Chithi.Client.Exchange.ExchangeClient.WorkerThreadDoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) InnerException:
Now my question is how am I supposed to insert such large data to sqlce db?
Regards,
Anindya Chatterjee
© Stack Overflow or respective owner