SqlConnection SqlConn = new SqlConnection("Server=.;Trusted_Connection=YES;DataBase=daigoudian");//创建数据库链接到daigoudian

        public void get_idstr(string[] str)
        {
            SqlDataAdapter Sqa = new SqlDataAdapter("Select id from daigoudian", SqlConn);
            DataSet ds = new DataSet();
            Sqa.Fill(ds);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow dr = ds.Tables[0].Rows[i];//得到行数据集,实际是个数组……
                str[i] = dr.ItemArray[0].ToString();
            }
        }//获取所有列id 的值并存入数组str中

相关文章:

  • 2021-06-29
  • 2021-07-11
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-08-26
  • 2022-01-30
  • 2022-03-10
猜你喜欢
  • 2022-12-23
  • 2021-09-01
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案