在我的场景中,我想插入具有 15 列数据的 sql 语句。还有其他方法来处理插入语句的参数吗?
public bool GetCustomersList(ref DataSet dataset, String x, String y, string z, string x1, string y1, string z1 )
{
MySqlConnection SQLConn = GetConnection();
try
{
string get_records;
if (SQLConn.State == ConnectionState.Closed)
{
SQLConn.Open();
}
if (searchtype == "x")
{
get_records = "INSERT into table values(x, y,z,x1,y1,z1);
}
MySqlCommand command = new MySqlCommand(get_records, SQLConn);
MySqlDataAdapter mySqlAdapter = new MySqlDataAdapter(command);
mySqlAdapter.Fill(dataset);
if (SQLConn.State == ConnectionState.Open)
{
SQLConn.Close();
}
return true;
}
catch (Exception )
{
if (SQLConn.State == ConnectionState.Open)
{
SQLConn.Close();
}
return false;
}
}
这里的参数可能会扩展到15或更多?在asp.net中如何处理这种情况?