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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog
C
Check Point Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
Vercel News
Vercel News
腾讯CDC
GbyAI
GbyAI
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security 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(); 
}
}