Files
lserp_cs_5.0/插件库/EmployeeManager/FrmTest.cs
T
2026-07-10 15:25:05 +08:00

60 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}
}
}