本文介绍了如何在wpf中解决System.out内存异常问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友,
我将大xmlfile插入mysqldatabase.But得到错误System.out的内存Exception.how to solve.plz帮帮我。这是我的code.thanks
Hi Friends,
am inserting large xmlfile into mysqldatabase.But got error System.out of memory Exception.how to solve.plz help me.this is my code .thanks
using ( var stringWriter = new StringWriter ( ) )
{
using ( var xmlTextWriter = XmlWriter.Create ( stringWriter ) )
{
XmlDoc2.WriteTo ( xmlTextWriter );
xmlTextWriter.Flush ( );
stringWriter.GetStringBuilder ( ).ToString ( );
string xmlstr = stringWriter.GetStringBuilder ( ).ToString ( );
DateTime today = DateTime.Now;
string strqry =
"insert into xmlfile ( XMLFile, DateTime) " +
"values ( @XMLFile, @DateTime )";
MySqlCommand cmd = new MySqlCommand ( strqry, connection, trns );
cmd.Parameters.AddWithValue ( "@XMLFile", xmlstr );
cmd.Parameters.AddWithValue ( "@DateTime", today );
cmd.ExecuteNonQuery ( );
}
}
推荐答案
这篇关于如何在wpf中解决System.out内存异常问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!