目的:
添加参数时,材料特性ID加一
string zid = "select max(材料特性ID) from 特性";
int mid = 1;
int id = Convert.ToInt32(zid) + mid;
string str = "'" + txtName.Text + "'," + "'" + txtyunxinglicheng.Text + "'," + "'" + txtyingdu.Text + "'," + "'" + txtlashenqiangdu.Text + "'," + "'" + txtladuanshenchanglv.Text + "'," + "'" + 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();
调试时int id = Convert.ToInt32(zid) + mid;id处显示为0,Convert.ToInt32(zid)好像没转换成功我该怎么改