?? pda_start.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace PDA_test
{
/// <summary>
/// Form1 的摘要說明。
/// </summary>
public class PDA_start : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Data.SqlClient.SqlConnection sql_conn;
private System.Data.SqlClient.SqlDataAdapter sql_da;
private System.Data.SqlClient.SqlCommandBuilder sql_cb;
private System.Data.SqlClient.SqlCommand sql_cmd;
private System.Data.SqlClient.SqlDataReader sql_dr;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox_ch;
private System.Windows.Forms.TextBox textBox_tm;
private System.Data.DataTable data_test;
private PDA_test.SY_HSXC lc_syhscx;
private PDA_test.JZ_HSXC lc_jzhsxc;
public PDA_start()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.textBox_ch = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox_tm = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
//
// button1
//
this.button1.Location = new System.Drawing.Point(72, 160);
this.button1.Size = new System.Drawing.Size(96, 32);
this.button1.Text = "查詢";
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// dataGridTextBoxColumn1
//
this.dataGridTextBoxColumn1.NullText = "(null)";
this.dataGridTextBoxColumn1.Width = 80;
//
// textBox_ch
//
this.textBox_ch.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.textBox_ch.Location = new System.Drawing.Point(24, 104);
this.textBox_ch.Size = new System.Drawing.Size(192, 23);
this.textBox_ch.Text = "";
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.label1.Location = new System.Drawing.Point(24, 80);
this.label1.Text = "門診號";
this.label1.ParentChanged += new System.EventHandler(this.label1_ParentChanged);
//
// textBox_tm
//
this.textBox_tm.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular);
this.textBox_tm.Location = new System.Drawing.Point(24, 40);
this.textBox_tm.Size = new System.Drawing.Size(192, 23);
this.textBox_tm.Text = "";
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular);
this.label2.Location = new System.Drawing.Point(24, 16);
this.label2.Text = "條形碼";
//
// PDA_start
//
this.ClientSize = new System.Drawing.Size(234, 256);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox_tm);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox_ch);
this.Controls.Add(this.button1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Text = "移動工作站";
this.Load += new System.EventHandler(this.PDA_start_Load);
}
#endregion
/// <summary>
/// 應用程序的主入口點。
/// </summary>
// static void Main()
// {
// Application.Run(new PDA_start());
// }
private void PDA_start_Load(object sender, System.EventArgs e)
{
string connSql="data source=172.16.10.19;user id=sa;password=1;initial catalog=FGYPDB";
//string connSql="workstation id=FGSOFT\\FGHIS;packet size=4096;user id=sa;data source=FGSOFT\\FGHIS;persist security info=True;initial catalog=BGFGMZDB;password=";
//;persist security info=True;packet size=4096
try
{
// sql_da = new SqlDataAdapter();
// SqlCommandBuilder sql_cb=new SqlCommandBuilder ();
// data_test=new DataTable();
sql_conn = new SqlConnection( connSql );
// MessageBox.Show(sql_conn.ConnectionString.ToString());
// this.sql_conn.Open();
// this.sql_conn.Close();
}
catch (SqlException ex)
{
MessageBox.Show( "Error connecting to the server: " + ex.Message );
}
// string connSql="workstation id=FUGLETEST;packet size=4096;user id=sa;data source=FUGLETEST;persist security info=True;initial catalog=Northwind;password=";
// try
// {71009.94 62840.64 4.08465
// sqlda = new SqlDataAdapter();
// SqlCommandBuilder sqlcb=new SqlCommandBuilder ();
// data_test=new DataTable();
// lcsqlconn = new SqlConnection( connSql );
//
// lcsqlconn.Open();
// sqlda =new SqlDataAdapter("select * from EmployeeTerritories", lcsqlconn );
// sqlcb =new SqlCommandBuilder( sqlda );
//
// //sqlda ( data_test );
//
// //this.dataGrid1.DataSource=data_test;
//
// }
// catch (SqlException ex)
// {
// MessageBox.Show( "Error connecting to the server: " + ex.Message );
// }
}
private void button1_Click_1(object sender, System.EventArgs e)
{
// //string m_connectionString="workstation id=FUGLETEST;packet size=4096;user id=sa;data source=FUGLETEST;persist security info=True;initial catalog=Northwind;password=";
// fugletest.Service1 service = new PDA_test.fugletest.Service1();
//
// service.SetDatabaseType("SQL Server");
//
// service.SetDbConnectionString("");
//
// service.Create();
//
// DataSet ds = service.ExecuteDataSet("select * from EmployeeTerritories");
//
// dataGrid1.DataSource = ds.Tables[0];
// 床位信息查詢
// try
// {
// data_test=new DataTable();
// string lc_cwh=this.textBox_ch.Text.ToString().Trim();
// string lc_mzh="";
// string lc_name="";
//
// string lc_sql_cmd="select * from dbo.輸液_輸液登記表 where 床位號='"+lc_cwh+"' and 狀態='2'";
// sql_conn.Open();
// sql_da =new SqlDataAdapter(lc_sql_cmd, sql_conn );
// sql_cb =new SqlCommandBuilder( sql_da );
// sql_da.Fill(data_test);
// //this.dataGrid1.DataSource=data_test;
// int lc_rowcount=data_test.Rows.Count;
// if (lc_rowcount==0)
// {
// MessageBox.Show("床位號碼輸入有誤!!");
// }
// else
// {
// string lc_cwzt=this.data_test.Rows[0]["狀態"].ToString().Trim();
// if (lc_cwzt=="2")
// {
// lc_mzh=this.data_test.Rows[0]["門診號"].ToString().Trim();
// lc_name=this.data_test.Rows[0]["姓名"].ToString().Trim();
// //MessageBox.Show(lc_mzh.ToString()+" "+lc_name.ToString());
// //調用SY_HSXC界面
// lc_syhscx=new SY_HSXC();
// lc_syhscx.cf_no="18247";
// lc_syhscx.br_jbxx=lc_mzh+","+lc_name;
// lc_syhscx.mzh=lc_mzh.ToString().Trim();
// lc_syhscx.ch=lc_cwh.ToString().Trim();
// lc_syhscx.Sql_conn_str=this.sql_conn;
// lc_syhscx.Show();
//
// //
// }
// else
// {
// MessageBox.Show("該床位沒有開放!");
// }
// }
//
//
// sql_conn.Close();
// }
// catch (SqlException ex)
// {
// MessageBox.Show( "Error connecting to the server: " + ex.Message );
// }
//床位信息查詢結束
//發票號碼查詢
//MessageBox.Show(sql_conn.ConnectionString.ToString());
try
{
data_test=new DataTable();
sql_cmd=new SqlCommand();
sql_cmd.Connection=sql_conn;
//string lc_mzh=this.textBox_ch.Text.ToString().Trim();
string lc_mzh=this.textBox_ch.Text.ToString().Trim();
string lc_name="";
string lc_sex="";
string lc_age="";
string lc_jzdm="";
string lc_sqlcmd="";
int lcret=0;
// string lc_sql_cmd="select * from 治療_任務記錄 where 門診編號='"+lc_cwh+"' and 狀態='0'";
string lc_sql_cmd="select 姓名,性別,出生日期,記帳代碼 from FGMZDB..門診_病人基本信息 where 門診號='"+lc_mzh+"'";
sql_conn.Open();
sql_da =new SqlDataAdapter(lc_sql_cmd, sql_conn );
sql_cb =new SqlCommandBuilder( sql_da );
sql_da.Fill(data_test);
sql_conn.Close();
//this.dataGrid1.DataSource=data_test;
int lc_rowcount=data_test.Rows.Count;
if (lc_rowcount==0)
{
MessageBox.Show("門診號有誤!!");
}
else
{
// lc_mzh=this.data_test.Rows[0]["門診號"].ToString().Trim();
lc_sqlcmd="exec pda_check_mzfph '"+lc_mzh+"'";
this.sql_conn.Open();
//MessageBox.Show(up_cmd.ToString());
sql_cmd.CommandText=lc_sqlcmd.ToString();
lcret=sql_cmd.ExecuteNonQuery();
this.sql_conn.Close();
//MessageBox.Show(lcret.ToString());
lc_name=this.data_test.Rows[0]["姓名"].ToString().Trim();
lc_sex=this.data_test.Rows[0]["性別"].ToString().Trim();
lc_age=this.data_test.Rows[0]["出生日期"].ToString().Trim();
lc_jzdm=this.data_test.Rows[0]["記帳代碼"].ToString().Trim();
//MessageBox.Show(lc_mzh.ToString()+" "+lc_name.ToString());
//調用SY_HSXC界面
// lc_jzhsxc=new JZ_HSXC();
// lc_jzhsxc.br_jbxx=lc_name+","+lc_sex+","+lc_age;
// lc_jzhsxc.mzh=lc_mzh;
// lc_jzhsxc.Sql_conn_str=this.sql_conn;
//
// // lc_syhscx.cf_no="18247";
// // lc_syhscx.br_jbxx=lc_mzh+","+lc_name;
// // lc_syhscx.mzh=lc_mzh.ToString().Trim();
// // lc_syhscx.ch=lc_cwh.ToString().Trim();
// // lc_syhscx.Sql_conn_str=this.sql_conn;
// lc_jzhsxc.Show();
//MessageBox.Show(lc_mzh.ToString()+"數據讀寫錯誤----001!!!"+lcret.ToString());
}
//sql_conn.Close();
}
catch (SqlException ex)
{
MessageBox.Show( "Error connecting to the server: " + ex.Message );
}
//發票號碼結束
}
private void label1_ParentChanged(object sender, System.EventArgs e)
{
}
private void button3_Click(object sender, System.EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -