这是代码:
autoInsert.Parameters.Add(new NpgsqlParameter("price", NpgsqlDbType.Numeric));
autoInsert.Parameters[0].Value = txt_price.Text;
con.Open();
autoInsert.ExecuteNonQuery();
con.Close();
当我执行查询时,它显示错误:“输入字符串的格式不正确。” 如何将该字符串转换为数字。 txt_price 是文本框。
最佳答案
autoInsert.Parameters[0].Value = ConvertToInt32(txt_price.Text);
关于c# - npgsql 字符串到数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8896157/