资源简介
c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统c#学生成绩管理系统
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace student
{
class database
{
public OleDbConnection Con Con1; //sql数据连接组件实例化
public OleDbCommand command = new OleDbCommand(); //初始化一个SQL命令对象
public database() //类初始化,初始化数据连接
{
string path = @“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=studentSystem.mdb“;
Con = new OleDbConnection(path);
}
public OleDbDataReader GetReader(string search)
{
OleDbDataReader Reader;
if (Con.State != ConnectionState.Open)
Con.Open();
OleDbCommand Com = new OleDbCommand(search Con);
Reader = Com.ExecuteReader();
return Reader;
}
// 输入查询字符串,返回dataset
public DataSet getData(string sql)
{
command.Connection = Con; //配置command对象
command.CommandText = sql; //赋予要执行的语句
DataSet dt = new DataSet(); //初始化一个数据返回集合
OleDbDataAdapter da = new OleDbDataAdapter(command);
Con.Open(); //打开连接
da.Fill(dt); //执行语句
command.Connection.Close(); //关闭连接
return dt;
}
//输入存储过程名称,执行查询存储过程
public DataSet getDataSet(string produreName)
{
command.Connection = Con; //赋予连接对象
//执行的类型为存储过程
command.CommandType = CommandType.StoredProcedure;
command.CommandText = produreName; //赋予执行的存储过程名字
DataSet dt = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(command);
Con.Open(); //打开连接
da.Fill(dt); //填充数据
command.Connection.Close();
return dt; //返回数据集
}
// 执行非查询SQL语句
public int ExecuteSql(string sql)
{
if (Con.State != ConnectionState.Open)
Con.Open(); //如果数据连接关闭,则打开
OleDbCommand Com = new OleDbCommand(sql Con);
Com.ExecuteNonQuery(); //执行非查询SQL语句
Con.Close();
return 1;
}
public int Execute(string sql)
{
if (Con.State != ConnectionState.Open)
Con.Open(); //如果数据连接关闭,则打开
OleDbCommand Com = new OleDbCommand(sql Con);
Com.ExecuteNonQuery(); //执行非查询SQL语句
return 1;
}
// 执行非查询数据库操作,是否关闭数据库连接 可以选择
public void ExecuteSql(string sql bool closeConnection)
{
if (C
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 141824 2008-12-11 18:27 新建文件夹 (2)\200631000723吴琦斌\200631000723吴琦斌.doc
文件 409 2007-11-30 16:40 新建文件夹 (2)\200631000723吴琦斌\student\student\app.config
文件 1700864 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.exe
文件 409 2007-11-30 16:40 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.exe.config
文件 208384 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.pdb
文件 14328 2009-07-21 10:51 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.vshost.exe
文件 409 2007-11-30 16:40 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.vshost.exe.config
文件 490 2007-07-21 01:33 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\student.vshost.exe.manifest
文件 1282048 2009-07-21 10:51 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug\studentSystem.mdb
文件 68057 2007-12-05 23:36 新建文件夹 (2)\200631000723吴琦斌\student\student\bin\Debug.rar
文件 7280 2007-12-12 21:15 新建文件夹 (2)\200631000723吴琦斌\student\student\databa
文件 25729 2009-06-27 15:40 新建文件夹 (2)\200631000723吴琦斌\student\student\ManagerForm.cs
文件 49732 2009-06-27 15:40 新建文件夹 (2)\200631000723吴琦斌\student\student\ManagerForm.Designer.cs
文件 2417104 2009-06-27 15:40 新建文件夹 (2)\200631000723吴琦斌\student\student\ManagerForm.resx
文件 36711 2007-12-12 21:11 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\ResolveAssemblyReference.cache
文件 2245 2009-07-21 10:51 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.csproj.FileListAbsolute.txt
文件 917 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.csproj.GenerateResource.Cache
文件 1700864 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.exe
文件 1607929 2009-06-27 15:40 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.ManagerForm.resources
文件 208384 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.pdb
文件 180 2008-12-11 17:07 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.Properties.Resources.resources
文件 180 2009-06-29 15:20 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\student.StudentForm.resources
文件 5120 2008-12-11 17:07 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 61440 2008-12-11 17:07 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\Debug\TempPE\studentSystemDataSet.Designer.cs.dll
文件 345 2007-12-12 23:18 新建文件夹 (2)\200631000723吴琦斌\student\student\obj\student.csproj.FileList.txt
文件 472 2007-12-02 12:22 新建文件夹 (2)\200631000723吴琦斌\student\student\Program.cs
文件 1168 2007-11-30 16:22 新建文件夹 (2)\200631000723吴琦斌\student\student\Properties\AssemblyInfo.cs
文件 2838 2008-12-11 17:06 新建文件夹 (2)\200631000723吴琦斌\student\student\Properties\Resources.Designer.cs
文件 5612 2007-11-30 16:22 新建文件夹 (2)\200631000723吴琦斌\student\student\Properties\Resources.resx
文件 1713 2008-12-11 17:06 新建文件夹 (2)\200631000723吴琦斌\student\student\Properties\Settings.Designer.cs
............此处省略34个文件信息
评论
共有 条评论