📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private static string dbPath = Application.StartupPath + @"\BatchProcessStudentWork.mdb";
public Form1()
{
InitializeComponent();
}
private void reportDocument1_InitReport(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection oleCon = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbPath);
string sqlStr = "SELECT * FROM CourseInfo";
OleDbCommand cmd = new OleDbCommand(sqlStr, oleCon);
OleDbDataAdapter odap = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
odap.Fill(ds, "CourseInfo");
this.reportDocument1.FileName = Application.StartupPath + @"\cryRpt.rpt";
this.reportDocument1.SetDataSource(ds);
this.crystalReportViewer2.ReportSource = this.reportDocument1;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -