主题:帮忙分析一下这个程序》??? 谢谢
private void ensureButton3_Click(object sender, System.EventArgs e)
{
int i = 1;
try
{
string myConnectString = "Persist Security Info=False;Integrated Security=SSPI;database=zhwPaper;server=CLC-31071999FBB\\CLC;Connect Timeout=30";
SqlConnection myConn = new SqlConnection(myConnectString);
myConn.Open();
SqlCommand cmd =myConn.CreateCommand();
cmd.CommandText = "INSERT INTO vector_value(price, time, reliability, availability, No) VALUES('"+expense.Text+"', '"+eTime.Text+"', '"+rValue.Text+"', '"+aValue.Text+",'"+"(i++)"+"'')";
cmd.ExecuteNonQuery();
}
catch(Exception c)
{
Console.WriteLine("写入数据库错误:/n{0}", c.Message);
}
quan_value[0] = float.Parse(expense.Text);
quan_value[1] = float.Parse(eTime.Text);
quan_value[2] = float.Parse(rValue.Text);
quan_value[3] = float.Parse(aValue.Text);
}
我这个程序以前可以写数据到数据库的,但是当加入
quan_value[0] = float.Parse(expense.Text);
quan_value[1] = float.Parse(eTime.Text);
quan_value[2] = float.Parse(rValue.Text);
quan_value[3] = float.Parse(aValue.Text);
后就不可以拉
不知道为什么拉
quan_value[4]是我定义的一个public类型的变量
{
int i = 1;
try
{
string myConnectString = "Persist Security Info=False;Integrated Security=SSPI;database=zhwPaper;server=CLC-31071999FBB\\CLC;Connect Timeout=30";
SqlConnection myConn = new SqlConnection(myConnectString);
myConn.Open();
SqlCommand cmd =myConn.CreateCommand();
cmd.CommandText = "INSERT INTO vector_value(price, time, reliability, availability, No) VALUES('"+expense.Text+"', '"+eTime.Text+"', '"+rValue.Text+"', '"+aValue.Text+",'"+"(i++)"+"'')";
cmd.ExecuteNonQuery();
}
catch(Exception c)
{
Console.WriteLine("写入数据库错误:/n{0}", c.Message);
}
quan_value[0] = float.Parse(expense.Text);
quan_value[1] = float.Parse(eTime.Text);
quan_value[2] = float.Parse(rValue.Text);
quan_value[3] = float.Parse(aValue.Text);
}
我这个程序以前可以写数据到数据库的,但是当加入
quan_value[0] = float.Parse(expense.Text);
quan_value[1] = float.Parse(eTime.Text);
quan_value[2] = float.Parse(rValue.Text);
quan_value[3] = float.Parse(aValue.Text);
后就不可以拉
不知道为什么拉
quan_value[4]是我定义的一个public类型的变量