利用ADO
演示環境
數據庫機器名
登陸名
密碼
數據庫名 db_test
下面建立一個表
create table tb_test(id int identity(
一
//
//
//下面的示例將c:\
//
//
using System;
using System
using System
using System
class image_test
{
[STAThread]
static void Main(string[] args)
{
try
{
//初始化OleDbConnection和OleDbCommand
OleDbConnection cn = new OleDbConnection(
OleDbCommand cmd = new OleDbCommand(
//打開文件
FileStream fs = new FileStream(
Byte[] b = new Byte[fs
fs
fs
//打開連接
OleDbParameter prm = new OleDbParameter(
ParameterDirection
cmd
cn
//執行
if (cmd
Console
else
Console
cn
}
catch(Exception ex)
{
Console
}
}
}?
二
//
//
//下面的示例用將數據庫的tb_test表中ID=
//
//
using System;
using System
using System
using System
class image_test
{
[STAThread]
static void Main(string[] args)
{
try
{
//初始化OleDbConnection和OleDbCommand
OleDbConnection cn = new OleDbConnection(
OleDbCommand cmd = new OleDbCommand(
//打開文件
FileStream fs = new FileStream(
Byte[] b = new Byte[fs
fs
fs
//打開連接
OleDbParameter prm = new OleDbParameter(
ParameterDirection
cmd
cn
//執行
if (cmd
Console
else
Console
cn
}
catch(Exception ex)
{
Console
}
}
}
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22228.html