string yinsu = "";
if (radioButton2.Checked == true) { yinsu = "紫外线"; }
else if (radioButton1.Checked == true) { yinsu = "温度、振动"; }
string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");
string str = "'" + txtName.Text + "'," + "'" + txtyunxinglicheng.Text + "'," + "'" + txtyingdu.Text + "'," + "'" + txtlashenqiangdu + "'," + "'" + txtladuanshenchanglv + "'," + "'" + yinsu + "'," + "'" + id + "'";
string sq = @"Data Source=" + dbPath;
m = new SQLiteConnection(sq);
m.Open();
string sql = "insert into " + tableName + " (传感器型号,运行里程,硬度,拉伸强度,拉断伸长率,因素,材料特性ID) values (" + str + ")";
SQLiteCommand command = new SQLiteCommand(sql, m);
command.ExecuteNonQuery();
m.Close();
问题1:原本打算自动生成一个id(string),在系统管理界面添加一组数,结果在dataGridView上材料特性ID显示为0,而数据库里显示为很长的一串字符
问题二:按修改按钮后 ,在Addcailiaoquxian.form1.TabText = (string)Eachcailiao.Rows[i].Cells[7].Value;//
处显示无法将类型为“System.Int64”的对象强制转换为类型“System.String”。如何处理