2024年3月25日发(作者:)
using System;
using c;
using entModel;
using ;
using g;
using ;
using ;
using ;
namespace zuoye22
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
//==============================================================================================
private void 精确查询_Click(object sender, EventArgs e)
{
if ( == " ")
("请先选择查询方式!", "提示");
else
{
String aa = @"Provider=.4.0;Data Source=C:Documents and
SettingsAdministrator桌面";
OleDbConnection oleDbConnection1 = new OleDbConnection();
tionString = aa;
string sql = "select * from 成语 where " + + "='" + +
"'";
OleDbCommand oleDbCommand1 = new OleDbCommand();
dText = sql;
tion = oleDbConnection1;
OleDbDataAdapter da = new OleDbDataAdapter(sql, oleDbConnection1);
DataSet ds = new DataSet();
try
{
();
(ds);
}
catch (Exception)
{
("对不起,精确查找失败!", "提示");
}
finally
{
();
}
urce = [0].DefaultView;
}
}
//========================================================================================
private void 模糊查询_Click(object sender, EventArgs e)
{
if ( == " ")
("请先选择查询方式!", "提示");
else
{
string aa = @"Provider=.4.0;Data Source=C:Documents and
SettingsAdministrator桌面";
OleDbConnection oleDbConnection1 = new OleDbConnection();
tionString = aa;
string sql = "select * from 成语 where " + + " like'" +
+ "%'";
OleDbCommand oleDbCommand1 = new OleDbCommand();
dText = sql;
tion = oleDbConnection1;
OleDbDataAdapter da = new OleDbDataAdapter(sql, oleDbConnection1);
DataSet ds = new DataSet();
try
{
();
(ds);
}
catch (Exception)
{
("对不起!模糊查询失败!", "提示");
}
finally
{
();
}
urce = [0].DefaultView;
}
}
//==============================================================================================
private void 添加_Click(object sender, EventArgs e)
{
string aa = @"Provider=.4.0;Data Source=C:Documents and
SettingsAdministrator桌面";
OleDbConnection con = new OleDbConnection();
tionString = aa;
string cmdText = @"insert into 成语 (拼音检索,汉字检索,备注) values ('" +
+ "','" + + "','" + + "')";
(cmdText);
OleDbCommand cmd = new OleDbCommand(cmdText, con);
try
{
();
eNonQuery();
}
catch (Exception)
{
("对不起!添加数据失败!", "提示");
}
发布评论