• 菜鸟学习C#数据库实例练习使用SqlDataReader,SqlCommand SqlConnection


    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 ContactName,CompanyName FROM Customers";
                SqlConnection conn=new SqlConnection(strCon);
                conn.Open();
                SqlCommand cmd = new SqlCommand(select, conn);
                SqlDataReader aReader = cmd.ExecuteReader();
                while (aReader.Read())
                    Console.WriteLine("'{0}' from {1}", aReader.GetString(0), aReader.GetString(1));
                aReader.Close();
                conn.Close();
               

               
               
                Console.ReadLine();


            }
          
          
        }
      
    }

  • 相关阅读:
    文本文件、二进制文件
    trunc()
    字符集、编码
    windows注册表:扫盲
    decode() & sign()
    移动前端工作的那些事前端制作之自适应制作篇
    css hack知识详解
    IE6兼容性大全
    JS正则匹配入门基础!
    [转载]Javascript中批量定义CSS样式 cssText属性
  • 原文地址:https://www.cnblogs.com/finallyliuyu/p/1515280.html
Copyright © 2020-2023  润新知