回覆列表
  • 1 # 錢布斯

    透過引數傳遞:

    string sql = "select count(*) from zhuce where username=@username and pwd=@pwd and type = @type";

    SqlConnection conn = new SqlConnection(Common.Context.SqlManager.CONN_STRING);

    conn.Open();

    SqlCommand cmd = new SqlCommand(sql, conn);

    cmd.Parameters.Add("@username",SqlDbType.VarChar,30);

    cmd.Parameters.Add("@pwd",SqlDbType.VarChar,30);

    cmd.Parameters.Add("@type",SqlDbType.VarChar,10);

    cmd.Parameters["@username"].Value = username;

    cmd.Parameters["@pwd"].Value = pwd;

    cmd.Parameters["@type"].Value = power.Text;

    int count = Convert.ToInt32(cmd.ExecuteScalar());

    conn.Close();

  • 中秋節和大豐收的關聯?
  • matlab which的用法?