惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
小众软件
小众软件
D
Docker
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
博客园 - 叶小钗
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
IT之家
IT之家
博客园 - 司徒正美
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog

博客园 - Gravitonium

AttributesError:XXXXX has no module named 'xfeatures2d' Install pyCuda on windows7 Install pytorch on windows7 Install face_recognition anaconda to install cv2 Install dlib on windows for python2.7 Solution for Python Extention matplotlib.pyplot loading Error Reactivate this account after 8-year-suspension RealPlayer10GOLD for FC5 installation problem Date comparison in SQL clauses How to sort out monitor "Sync out of range" problem for Linux Box VS.net 2003 “Linker Tools Error LNK2001” 解决方案 Java programming problem in linux box: Exception in thread "main" java.lang.NoClassDefFoundError Solution to MySQL Connection Problem Example of a Web client invoke WebService using ASP 彻底清除3721上网助手 How to remove rigistry entry from the list of services PERL之模式匹配 Access数据库执行insert语句产生的问题
Demonstration of Database programming using ADO.net with ...
Gravitonium · 2004-11-29 · via 博客园 - Gravitonium

/*
Description:
This is an example program that demonstrate how to use ADO.net to connect
the SQL server and retrieve data from it under the Console Mode.

Author:Fenghua Lu
Date: May 2, 03
*/
using System;
using System.Data;
using System.Data.OleDb;

class DbTest{
public static void Main(){
string sConnectionString="Provider=sqloledb;Data Source=localhost;Initial Catalog=polaris;User Id=sa;Password=polaris;";    
   OleDbConnection objConn=new OleDbConnection(sConnectionString);
      objConn.Open();
     
      OleDbCommand  objCmdSelect=new  OleDbCommand("select * from userinfo");
   OleDbDataAdapter objAdapter1=new OleDbDataAdapter();

   objAdapter1.SelectCommand=objCmdSelect; 
   objAdapter1.SelectCommand.Connection=objConn;
   
   IDataReader reader= objCmdSelect.ExecuteReader();
   
           while (reader.Read())
            {
             Console.WriteLine(@"{0:d} | {1,20:c} | {2:c} | {3}",reader["id"], reader["username"],reader["birthday"],reader["memo"]);
             Console.WriteLine("---------------------------------------------------------------------------");
            } 
        
   objConn.Close(); 
}
}