在我的方案中,我想插入具有15列數據的sql語句。是否有任何其他方式來處理插入語句的參數?C#:如何在MySQL中插入語句動態插入多個參數
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中處理這種情況?