回覆列表
  • 1 # 使用者7266214309263

    using System.Data.SqlClient;

    SqlConnection conn = new SqlConnection();

    string connectionString="server=.;database=Sql;uid=sa; pwd=123456";

    conn.ConnectionString = connectionString;

    conn.open();

    string sqlStr = "SELECT * FROM table1";

    SqlCommand cmd = new SqlCommand();

    cmd.Connection = conn;

    cmd.CommandText = sqlStr;

    cmd.CommandType = CommandType.Text;

    int i = Convert.ToInt32(cmd.ExecuteNonQuery());

    Console.Write("共有" + i.ToString() + "條資料");

    conn.Close();

  • 中秋節和大豐收的關聯?
  • 創魔混沌魔法符文怎麼配?