60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
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;
|
||
using System.Data.SqlClient;
|
||
using CommonLib;
|
||
|
||
namespace EmployeeManager
|
||
{
|
||
public partial class FrmTest : Form
|
||
{
|
||
public FrmTest()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
MessageBox.Show("测试窗口");
|
||
}
|
||
|
||
private void FrmTest_Load(object sender, EventArgs e)
|
||
{
|
||
//这里可以引用DllBaseClass类中的静态参数
|
||
checkBox1.Text = DllBaseClass.m_myName;
|
||
|
||
|
||
//执行sql语句返回结果集
|
||
using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, "select top 10 EmployeeName from p_Employeetab", null))
|
||
{
|
||
while (dr.Read())
|
||
{
|
||
listBox1.Items.Add(dr["EmployeeName"].ToString());
|
||
}
|
||
}
|
||
|
||
//执行存储过程返回结果集
|
||
SqlParameter[] cmdParams = new SqlParameter[] {
|
||
new SqlParameter("@NewMsgCount",SqlDbType.Int),
|
||
new SqlParameter("@NewEmailCount",SqlDbType.Int)
|
||
};
|
||
cmdParams[0].Direction = ParameterDirection.Output;
|
||
cmdParams[1].Direction = ParameterDirection.Output;
|
||
|
||
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "pr_ReadOnlinePersons", "MyTableName", cmdParams);
|
||
|
||
foreach (DataRow drRow in ds.Tables["MyTableName"].Rows)
|
||
{
|
||
listBox2.Items.Add(drRow["EmployeeName"].ToString());
|
||
}
|
||
|
||
label1.Text = string.Format("输出参数1:{0},输出参数2:{1}",cmdParams[0].Value,cmdParams[1].Value);
|
||
}
|
||
}
|
||
}
|