如何在文本框中编写XML? [英] How to Write XML in Textbox?
本文介绍了如何在文本框中编写XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从Database中获取文本框中的XML数据。现在我想在DB中进行一些更改和更新。当我尝试更改文本框不允许文本时,但它会删除数据。我的代码
private void button1_Click(object sender,EventArgs e)
{
connection.Open();
string str =从表中选择col1,其中Clo2 ='+ txt1.Text +';
SqlCommand command = new SqlCommand(str,con);
XmlReader xmlreader = command .ExecuteXmlReader();
xmlreader.Read();
txt2.Text = xml.ReadOuterXml();
XmlDocument document = new XmlDocument();
document .PreserveWhitespace = true;
document .LoadXml(txt2.Text);
}
如何在文本框中输入文本
解决方案
< blockquote> *你确定你没有在这个上面放置另一个文本框吗?
*文本框属性ReadOnly = false?
*文本框属性Enabled = true?
I fetch the XML data in Textbox from Database.Now i want to make some changes and update in DB.when i try to make changes textbox not allowed text,but it remmove the data. MY code
private void button1_Click(object sender, EventArgs e) { connection.Open(); string str = "select col1 from Table where Clo2='" + txt1.Text + "'"; SqlCommand command = new SqlCommand(str, con); XmlReader xmlreader = command .ExecuteXmlReader(); xmlreader.Read(); txt2.Text = xml.ReadOuterXml(); XmlDocument document = new XmlDocument(); document .PreserveWhitespace = true; document .LoadXml(txt2.Text); }
how can i enter text in Textbox
解决方案
* Are you certain you didnt place another textbox above this one?
* Is the textbox attribute ReadOnly=false?
* Is the textbox attribute Enabled=true?
这篇关于如何在文本框中编写XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文