新手问题:有类sql
public class sql
{
public void cmd(string sql)
{
string strconn = "……省略……";
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
}
调用类时:
sql jj = new sql();
string strsql1 = "…省略… ";
SqlCommand cmd1 = new SqlCommand(strsql1, conn);
cmd1 = jj.cmd(strsql1);
提示 void 无法转化为System.Data.SqlClient.SqlCommand
怎么改呢?
茅侃侃
翻阅古今
UYOU
相关分类