using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
           string strCon="server=(local);database=northwind;uid=sa;pwd=123456";
            string select="SELECT *FROM Products";
            SqlConnection conn=new SqlConnection(strCon);
            SqlDataAdapter da=new SqlDataAdapter(select,conn);
            DataSet ds=new DataSet();//内存中的数据集合区
            da.Fill(ds,"Customers");
            foreach(DataRow row in ds.Tables["Customers"].Rows)
                Console.WriteLine("'{0}'from{1}",row[0],row[1]);
           

           
           
            Console.ReadLine();


        }
      
      
    }
  
}

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
猜你喜欢
  • 2021-08-25
  • 2021-09-05
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2021-11-15
  • 2022-01-02
相关资源
相似解决方案