党员红色参观活动方案:赏100分,比较难的问题,高手近来

来源:百度文库 编辑:神马品牌网 时间:2024/05/10 23:18:45
从TextBox里面输入的文字负值到temparray,这句没啥问题,可是我现在想改成从access数据库里导出到temparray
原来正确:
string[] tempArray = new string [inputTextBox.Lines.Length];
tempArray = inputTextBox.Lines;
现在报错的:
string[] tempArray = new string [inputTextBox.Lines.Length];
tempArray = reader_msg["msg"].ToString();

后面的代码是这样的:
for(int counter=0; counter < tempArray.Length;counter++)
{
if (tempArray[counter].Length > 0)
{
//mySoc.SendData(tempArray[counter]);
SendToAllConnectedUse(tempArray[counter]);
outputListBox.Items.Add("Me >>"+ tempArray[counter]);
}
}
应该怎么写
是写作错了,不用管哪一句,现在报错的是下面一句
tempArray = reader_msg["msg"].ToString();

他说无法将类型"string"隐式转换为"string[]",就是这个问题。。。

string[] tempArray = reader_msg["msg"].ToString().Split('\n');

for(int counter=0; counter < tempArray.Length;counter++)
{
if (tempArray[counter].Length > 0)
{
//mySoc.SendData(tempArray[counter]);
SendToAllConnectedUse(tempArray[counter]);
outputListBox.Items.Add("Me >>"+ tempArray[counter]);
}
}

好难``````````这个`````````找人来修电脑吧```````````````

string[] tempArray = new string [inputTextBox.Lines.Length];
这句应该改一下吧,你既然赋值改从数据库提取了,这里的应该改一下,是不是粗心了啊,呵呵
不应该还是 TextBox.Lines.Length 了吧

你可以看一看SQL语句和.net的ADO编程内容.