多行文本框,如何实现每一行插入数据库一行

2025-04-06 04:24:12
推荐回答(1个)
回答1:

string mulStr = textBox5.Text, val = "";
var j = 0;
while (mulStr.Length > 0)
{
if (mulStr.IndexOf("\r\n") == -1)
{
val = mulStr;
mulStr = "";
}
else
{
j = mulStr.IndexOf("\r\n");
val = mulStr.Substring(0, j);
mulStr = mulStr.Remove(0, val.Length + 2);

}
///处理取到的val值
}