admin 管理员组

文章数量: 1086019


2024年5月19日发(作者:navicat设置oracle表id自增)

using System;

using c;

using entModel;

using ;

using ;

using g;

using ;

using ;

using ;

using ;

namespace Location

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

= "Location System";

= "连接数据库";

= "查询";

= "退出";

= "添加";

= "删除";

= "修改";

= "ID:";

= "0";

}

private void button1_Click(object sender, EventArgs e)

{

string ConStr = "Provider=.4.0;data

source=";//创建OleDbConnection对象

OleDbConnection con = new OleDbConnection(ConStr);

();

if ( == )

{

("Access数据库的连接成功!", "Access数据库的连接");

}

else

{

("Access数据库的连接失败!", "Access数据库的连接");

}

();

}

private void button3_Click(object sender, EventArgs e) //退出

{

();

}

private void button2_Click(object sender, EventArgs e) //查询

模块

{

string ConStr = "Provider=.4.0;data

source=";//创建OleDbConnection对象

OleDbConnection con = new OleDbConnection(ConStr);

();

int i = 16(textBox1 .Text);

OleDbCommand cmd = new OleDbCommand("Select * From data where ID>=@id",

con);

("@id",i);

OleDbDataReader reader = eReader();

();

// = reader[0].ToString();

= reader[1].ToString();

= reader[2].ToString();

= reader[3].ToString();

= reader[4].ToString();

= reader[5].ToString();

= reader[6].ToString();

();

();

}

private void button4_Click(object sender, EventArgs e) //添加

{

string ConStr = "Provider=.4.0;data

source=";//创建OleDbConnection对象

OleDbConnection con = new OleDbConnection(ConStr);

();

for (int i = 0; i < 1000; i++)

{

string sql = "insert into data(ID)values(" + i + ")";

OleDbCommand cmd = new OleDbCommand(sql, con);

eNonQuery();


本文标签: 连接 数据库 设置 对象 作者