-
大小: 21.71MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2023-06-17
- 語言: C#
- 標(biāo)簽:
資源簡介
C#教務(wù)系統(tǒng)namespace xitong
{
public class DataAccess
{
public String connstr; //連接字符串
SqlConnection conn; // 連接對象
SqlCommand cmd; //命名對象
SqlDataAdapter da;//數(shù)據(jù)適配器
public String getconn() //定義一個連接字符串的方法
{
connstr = @"data source=.\SQLEXPRESS;initial catalog=sscggl;integrated security=true;";
return connstr;
}
public bool excutesql(string sql) //返回影響的行數(shù)
{
try
{
conn = new SqlConnection(getconn());
conn.Open();
}
catch
{
MessageBox.Show("數(shù)據(jù)連接失敗", "溫馨提示");
}
try
{
cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
// conn.Close();
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "操作失敗");
return false;
}
finally
{
conn.Close();
}
}
public DataSet getdataset(string sql, string tablename) //返回數(shù)據(jù)集
{
DataSet ds = new DataSet(); //定義一個數(shù)據(jù)集
conn = new SqlConnection(getconn()); //連接對象
conn.Open(); //打開連接
try
{
da = new SqlDataAdapter(sql, conn);
da.Fill(ds, tablename);
//conn.Close();
return ds;
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
finally
{
conn.Close();
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
namespace?xitong
{
????public?partial?class?Bangzhu?:?Form
????{
????????public?Bangzhu()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????this.Close();
????????}
??????
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????1048576??2013-12-19?01:43??C#\sscggl.Ldf
?????文件????3145728??2013-12-19?01:43??C#\sscggl.Mdf
?????文件?????460800??2014-12-15?10:32??C#\xitong1\Setup1\Debug\setup.exe
?????文件????6282240??2014-12-15?10:32??C#\xitong1\Setup1\Debug\Setup1.msi
?????文件??????46349??2014-12-15?10:32??C#\xitong1\Setup1\Setup1.vdproj
?????文件????????122??2014-12-25?17:43??C#\xitong1\xitong\app.config
?????文件????????485??2014-11-28?10:34??C#\xitong1\xitong\Bangzhu.cs
?????文件???????3153??2014-11-28?10:34??C#\xitong1\xitong\Bangzhu.Designer.cs
?????文件???????5814??2014-11-28?10:34??C#\xitong1\xitong\Bangzhu.resx
?????文件????1100392??2007-10-10?09:48??C#\xitong1\xitong\bin\Debug\Microsoft.Office.Interop.Excel.dll
?????文件??????64088??2007-10-10?09:48??C#\xitong1\xitong\bin\Debug\Microsoft.Vbe.Interop.dll
?????文件?????223800??2007-10-10?09:48??C#\xitong1\xitong\bin\Debug\office.dll
?????文件???????4608??2014-12-25?17:43??C#\xitong1\xitong\bin\Debug\sr-Latn-CS\xitong.resources.dll
?????文件????4314112??2014-12-25?17:43??C#\xitong1\xitong\bin\Debug\xitong.exe
?????文件????????122??2014-12-25?17:43??C#\xitong1\xitong\bin\Debug\xitong.exe.config
?????文件?????349696??2014-12-25?17:43??C#\xitong1\xitong\bin\Debug\xitong.pdb
?????文件??????14328??2014-12-25?16:50??C#\xitong1\xitong\bin\Debug\xitong.vshost.exe
?????文件????????122??2014-12-25?17:43??C#\xitong1\xitong\bin\Debug\xitong.vshost.exe.config
?????文件????????490??2009-06-11?05:14??C#\xitong1\xitong\bin\Debug\xitong.vshost.exe.manifest
?????文件???????2279??2013-10-30?20:28??C#\xitong1\xitong\DataAccess.cs
?????文件??????18980??2013-12-19?01:18??C#\xitong1\xitong\Form1.cs
?????文件??????40622??2013-12-18?20:52??C#\xitong1\xitong\Form1.Designer.cs
?????文件???????6012??2013-12-18?20:52??C#\xitong1\xitong\Form1.resx
?????文件???????1502??2014-11-19?10:28??C#\xitong1\xitong\Frmaddcj.cs
?????文件???????9175??2014-11-14?11:39??C#\xitong1\xitong\Frmaddcj.Designer.cs
?????文件???????5814??2014-11-14?11:39??C#\xitong1\xitong\Frmaddcj.resx
?????文件???????1244??2013-12-05?18:08??C#\xitong1\xitong\FrmaddClass.cs
?????文件???????6923??2013-12-05?18:08??C#\xitong1\xitong\FrmaddClass.Designer.cs
?????文件???????5814??2013-12-05?18:08??C#\xitong1\xitong\FrmaddClass.resx
?????文件???????1483??2014-11-28?11:23??C#\xitong1\xitong\FrmaddCourseInfo.cs
............此處省略169個文件信息
評論
共有 條評論