[求助] 一个c#写入数据库的代码,但是总是出错写不进去??请帮忙看看
private void ensureButton3_Click(object sender, System.EventArgs e){
float price, time, reliability, availability;
price = float.Parse(expense.Text);
time = float.Parse(eTime.Text);
reliability = float.Parse(rValue.Text);
availability = float.Parse(aValue.Text);
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) VALUE('"+price+"', '"+time+"', '"+reliability+"', '"+availability+"')";
cmd.ExecuteNonQuery();
}
catch(Exception c)
{
Console.WriteLine("写入数据库错误:/n{0}", c.Message);
}
输入的数据写不到数据库中
请帮忙看看我那里出错拉
谢谢拉