bedid.aspx.cs
上传用户:clhb88
上传日期:2009-09-26
资源大小:3468k
文件大小:20k
源码类别:

医药行业

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. using System.IO;
  13. namespace 医院管理系统
  14. {
  15. /// <summary>
  16. /// bedid 的摘要说明。
  17. /// </summary>
  18. public class bedid : System.Web.UI.Page
  19.  
  20. {
  21. protected System.Web.UI.WebControls.DataGrid DataGrid1;
  22. protected System.Web.UI.WebControls.Button Button4;
  23. protected System.Data.SqlClient.SqlConnection cnn;
  24. protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
  25. protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
  26. protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
  27. protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
  28. protected System.Data.SqlClient.SqlDataAdapter sda;
  29. protected 医院管理系统.zhu zhu1;
  30. protected System.Data.SqlClient.SqlCommand cmd;
  31. protected System.Web.UI.WebControls.Panel p1;
  32. protected System.Web.UI.WebControls.TextBox tch;
  33. protected System.Web.UI.WebControls.TextBox tnum;
  34. protected System.Web.UI.WebControls.TextBox tname;
  35. protected System.Web.UI.WebControls.TextBox tage;
  36. protected System.Web.UI.WebControls.RadioButtonList r1;
  37. protected System.Web.UI.WebControls.DropDownList d1;
  38. protected System.Web.UI.WebControls.DropDownList d2;
  39. protected System.Web.UI.WebControls.DropDownList d3;
  40. protected System.Web.UI.WebControls.Button Button1;
  41. protected System.Web.UI.WebControls.Button Button2;
  42. protected System.Web.UI.WebControls.TextBox t1;
  43. protected 医院管理系统.allpepole allpepole1;
  44. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
  45. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
  46. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
  47. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
  48. protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator5;
  49. protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
  50. protected System.Data.SqlClient.SqlCommand sqlSelectCommand2;
  51. protected System.Data.SqlClient.SqlCommand sqlInsertCommand2;
  52. protected System.Data.SqlClient.SqlCommand sqlUpdateCommand2;
  53. protected System.Data.SqlClient.SqlCommand sqlDeleteCommand2;
  54. protected System.Data.SqlClient.SqlDataAdapter sda1;
  55. protected 医院管理系统.zhuyuan zhuyuan1;
  56. protected System.Data.SqlClient.SqlCommand cmd1;
  57. protected System.Web.UI.WebControls.HyperLink HyperLink2;
  58. protected System.Web.UI.WebControls.HyperLink HyperLink1;
  59. protected System.Web.UI.WebControls.Image Image1;
  60. protected System.Web.UI.WebControls.DataGrid DataGrid2;
  61. protected System.Data.SqlClient.SqlCommand sqlSelectCommand3;
  62. protected System.Data.SqlClient.SqlCommand sqlInsertCommand3;
  63. protected System.Data.SqlClient.SqlCommand sqlUpdateCommand3;
  64. protected System.Data.SqlClient.SqlCommand sqlDeleteCommand3;
  65. protected System.Data.SqlClient.SqlDataAdapter sda3;
  66. protected System.Data.SqlClient.SqlCommand cmd2;
  67. protected 医院管理系统.sda3 sda31;
  68. protected System.Web.UI.WebControls.Image Image2;
  69. protected System.Web.UI.WebControls.TextBox TextBox1;
  70. protected System.Web.UI.WebControls.Button Button3;
  71. protected System.Data.SqlClient.SqlCommand sqlSelectCommand4;
  72. protected System.Data.SqlClient.SqlCommand sqlInsertCommand4;
  73. protected System.Data.SqlClient.SqlCommand sqlUpdateCommand4;
  74. protected System.Data.SqlClient.SqlCommand sqlDeleteCommand4;
  75. protected System.Data.SqlClient.SqlDataAdapter sda4;
  76. protected System.Web.UI.WebControls.Button Button5;
  77. Cpass cpa =new Cpass();
  78. private void Page_Load(object sender, System.EventArgs e)
  79. {   
  80. try
  81. {
  82. string user= Session["usename"].ToString();
  83. string pwd=Session["pwds"].ToString() ; //获得变量值
  84. if(cpa.CH(user, pwd, "床位分配")=="Norights")//用户名或密码错或无权限
  85. Response.Redirect("index.aspx"); } 
  86. catch{  Response.Redirect("index.aspx");} 
  87. fills();
  88. fill();
  89. if(cnn.State==0) cnn.Open();
  90. sda1.SelectCommand.ExecuteNonQuery();
  91. zhuyuan1.Clear(); 
  92. sda1.Fill(zhuyuan1); 
  93. cnn.Close();
  94. d2.DataBind(); 
  95. }
  96.      
  97. #region Web 窗体设计器生成的代码
  98. override protected void OnInit(EventArgs e)
  99. {
  100. //
  101. // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
  102. //
  103. InitializeComponent();
  104. base.OnInit(e);
  105. }
  106. /// <summary>
  107. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  108. /// 此方法的内容。
  109. /// </summary>
  110. private void InitializeComponent()
  111. {    
  112. this.cnn = new System.Data.SqlClient.SqlConnection();
  113. this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
  114. this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
  115. this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
  116. this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
  117. this.sda = new System.Data.SqlClient.SqlDataAdapter();
  118. this.zhu1 = new 医院管理系统.zhu();
  119. this.cmd = new System.Data.SqlClient.SqlCommand();
  120. this.allpepole1 = new 医院管理系统.allpepole();
  121. this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
  122. this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
  123. this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand();
  124. this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand();
  125. this.sda1 = new System.Data.SqlClient.SqlDataAdapter();
  126. this.zhuyuan1 = new 医院管理系统.zhuyuan();
  127. this.cmd1 = new System.Data.SqlClient.SqlCommand();
  128. this.sqlSelectCommand3 = new System.Data.SqlClient.SqlCommand();
  129. this.sqlInsertCommand3 = new System.Data.SqlClient.SqlCommand();
  130. this.sqlUpdateCommand3 = new System.Data.SqlClient.SqlCommand();
  131. this.sqlDeleteCommand3 = new System.Data.SqlClient.SqlCommand();
  132. this.sda3 = new System.Data.SqlClient.SqlDataAdapter();
  133. this.cmd2 = new System.Data.SqlClient.SqlCommand();
  134. this.sda31 = new 医院管理系统.sda3();
  135. this.sqlSelectCommand4 = new System.Data.SqlClient.SqlCommand();
  136. this.sqlInsertCommand4 = new System.Data.SqlClient.SqlCommand();
  137. this.sqlUpdateCommand4 = new System.Data.SqlClient.SqlCommand();
  138. this.sqlDeleteCommand4 = new System.Data.SqlClient.SqlCommand();
  139. this.sda4 = new System.Data.SqlClient.SqlDataAdapter();
  140. ((System.ComponentModel.ISupportInitialize)(this.zhu1)).BeginInit();
  141. ((System.ComponentModel.ISupportInitialize)(this.allpepole1)).BeginInit();
  142. ((System.ComponentModel.ISupportInitialize)(this.zhuyuan1)).BeginInit();
  143. ((System.ComponentModel.ISupportInitialize)(this.sda31)).BeginInit();
  144. this.Button3.Click += new System.EventHandler(this.Button3_Click);
  145. this.Button1.Click += new System.EventHandler(this.Button1_Click);
  146. this.Button2.Click += new System.EventHandler(this.Button2_Click);
  147. this.Button5.Click += new System.EventHandler(this.Button5_Click);
  148. this.Button4.Click += new System.EventHandler(this.Button4_Click);
  149. this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);
  150. this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
  151. // 
  152. // cnn
  153. // 
  154. this.cnn.ConnectionString = "workstation id="802-HUANGHAI";packet size=4096;integrated security=SSPI;data sour" +
  155. "ce=".";persist security info=False;initial catalog=医院管理系统";
  156. // 
  157. // sqlSelectCommand1
  158. // 
  159. this.sqlSelectCommand1.CommandText = "[tian]";
  160. this.sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure;
  161. this.sqlSelectCommand1.Connection = this.cnn;
  162. this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  163. // 
  164. // sqlUpdateCommand1
  165. // 
  166. this.sqlUpdateCommand1.CommandText = "[chuyuan]";
  167. this.sqlUpdateCommand1.CommandType = System.Data.CommandType.StoredProcedure;
  168. this.sqlUpdateCommand1.Connection = this.cnn;
  169. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  170. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@床号", System.Data.SqlDbType.NVarChar, 20));
  171. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@挂号号码", System.Data.SqlDbType.NVarChar, 10));
  172. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.NVarChar, 20));
  173. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.NVarChar, 10));
  174. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年龄", System.Data.SqlDbType.NVarChar, 10));
  175. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@级别", System.Data.SqlDbType.NVarChar, 10));
  176. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@负责人", System.Data.SqlDbType.NVarChar, 50));
  177. this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@进出实况", System.Data.SqlDbType.NVarChar, 20));
  178. // 
  179. // sda
  180. // 
  181. this.sda.DeleteCommand = this.sqlDeleteCommand1;
  182. this.sda.InsertCommand = this.sqlInsertCommand1;
  183. this.sda.SelectCommand = this.sqlSelectCommand1;
  184. this.sda.UpdateCommand = this.sqlUpdateCommand1;
  185. // 
  186. // zhu1
  187. // 
  188. this.zhu1.DataSetName = "zhu";
  189. this.zhu1.Locale = new System.Globalization.CultureInfo("zh-CN");
  190. // 
  191. // cmd
  192. // 
  193. this.cmd.CommandText = "[bedup]";
  194. this.cmd.CommandType = System.Data.CommandType.StoredProcedure;
  195. this.cmd.Connection = this.cnn;
  196. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  197. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@床号", System.Data.SqlDbType.NVarChar, 20));
  198. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@挂号号码", System.Data.SqlDbType.NVarChar, 10));
  199. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.NVarChar, 20));
  200. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.NVarChar, 10));
  201. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年龄", System.Data.SqlDbType.NVarChar, 10));
  202. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@级别", System.Data.SqlDbType.NVarChar, 10));
  203. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@负责人", System.Data.SqlDbType.NVarChar, 50));
  204. this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@进出实况", System.Data.SqlDbType.NVarChar, 20));
  205. // 
  206. // allpepole1
  207. // 
  208. this.allpepole1.DataSetName = "allpepole";
  209. this.allpepole1.Locale = new System.Globalization.CultureInfo("zh-CN");
  210. // 
  211. // sqlSelectCommand2
  212. // 
  213. this.sqlSelectCommand2.CommandText = "[zhuy]";
  214. this.sqlSelectCommand2.CommandType = System.Data.CommandType.StoredProcedure;
  215. this.sqlSelectCommand2.Connection = this.cnn;
  216. this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  217. // 
  218. // sda1
  219. // 
  220. this.sda1.DeleteCommand = this.sqlDeleteCommand2;
  221. this.sda1.InsertCommand = this.sqlInsertCommand2;
  222. this.sda1.SelectCommand = this.sqlSelectCommand2;
  223. this.sda1.UpdateCommand = this.sqlUpdateCommand2;
  224. // 
  225. // zhuyuan1
  226. // 
  227. this.zhuyuan1.DataSetName = "zhuyuan";
  228. this.zhuyuan1.Locale = new System.Globalization.CultureInfo("zh-CN");
  229. // 
  230. // cmd1
  231. // 
  232. this.cmd1.CommandText = "[zy]";
  233. this.cmd1.CommandType = System.Data.CommandType.StoredProcedure;
  234. this.cmd1.Connection = this.cnn;
  235. this.cmd1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  236. this.cmd1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.Int, 4));
  237. // 
  238. // sqlSelectCommand3
  239. // 
  240. this.sqlSelectCommand3.CommandText = "[z2]";
  241. this.sqlSelectCommand3.CommandType = System.Data.CommandType.StoredProcedure;
  242. this.sqlSelectCommand3.Connection = this.cnn;
  243. this.sqlSelectCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  244. // 
  245. // sda3
  246. // 
  247. this.sda3.DeleteCommand = this.sqlDeleteCommand3;
  248. this.sda3.InsertCommand = this.sqlInsertCommand3;
  249. this.sda3.SelectCommand = this.sqlSelectCommand3;
  250. this.sda3.UpdateCommand = this.sqlUpdateCommand3;
  251. // 
  252. // cmd2
  253. // 
  254. this.cmd2.CommandText = "[z3]";
  255. this.cmd2.CommandType = System.Data.CommandType.StoredProcedure;
  256. this.cmd2.Connection = this.cnn;
  257. this.cmd2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  258. this.cmd2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.Int, 4));
  259. // 
  260. // sda31
  261. // 
  262. this.sda31.DataSetName = "sda3";
  263. this.sda31.Locale = new System.Globalization.CultureInfo("zh-CN");
  264. // 
  265. // sqlSelectCommand4
  266. // 
  267. this.sqlSelectCommand4.CommandText = "[z4]";
  268. this.sqlSelectCommand4.CommandType = System.Data.CommandType.StoredProcedure;
  269. this.sqlSelectCommand4.Connection = this.cnn;
  270. this.sqlSelectCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
  271. this.sqlSelectCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@num", System.Data.SqlDbType.NVarChar, 10));
  272. // 
  273. // sda4
  274. // 
  275. this.sda4.DeleteCommand = this.sqlDeleteCommand4;
  276. this.sda4.InsertCommand = this.sqlInsertCommand4;
  277. this.sda4.SelectCommand = this.sqlSelectCommand4;
  278. this.sda4.UpdateCommand = this.sqlUpdateCommand4;
  279. this.DataGrid2.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid2_PageIndexChanged);
  280. this.DataGrid2.SelectedIndexChanged += new System.EventHandler(this.DataGrid2_SelectedIndexChanged_1);
  281. this.Load += new System.EventHandler(this.Page_Load);
  282. ((System.ComponentModel.ISupportInitialize)(this.zhu1)).EndInit();
  283. ((System.ComponentModel.ISupportInitialize)(this.allpepole1)).EndInit();
  284. ((System.ComponentModel.ISupportInitialize)(this.zhuyuan1)).EndInit();
  285. ((System.ComponentModel.ISupportInitialize)(this.sda31)).EndInit();
  286. }
  287. #endregion
  288. private void Button1_Click(object sender, System.EventArgs e)
  289. {    
  290. try
  291. {
  292. if(cnn.State==0) cnn.Open();
  293. cmd.Parameters["@床号"].Value=tch.Text;
  294. cmd.Parameters["@挂号号码"].Value=tnum.Text;
  295. cmd.Parameters["@姓名"].Value =tname.Text ;
  296. cmd.Parameters ["@年龄"].Value=tage.Text ;
  297. cmd.Parameters ["@性别"].Value=r1.SelectedValue ;
  298. cmd.Parameters ["@级别"].Value=d1.SelectedValue ;
  299. cmd.Parameters ["@负责人"].Value=d2.SelectedValue ;
  300. cmd.Parameters ["@进出实况"].Value=d3.SelectedValue ;
  301. cmd.ExecuteNonQuery();
  302.              Response.Write("<script language=javascript>alert('入院成功!');</script>") ;
  303. }
  304. catch
  305. {
  306. Response.Write("<script language=javascript>alert('床号或挂号号码存在!');</script>") ;
  307. }
  308. cnn.Close();
  309. fills();
  310. fill();
  311. }
  312. private void fill()
  313. {
  314. if(cnn.State==0) cnn.Open();
  315.           sda.SelectCommand.ExecuteNonQuery();
  316. sda31.Clear();
  317. sda3.Fill(sda31);
  318. cnn.Close();
  319. this.DataGrid2.DataBind();
  320. }
  321. private void fills()
  322. {
  323. if(cnn.State==0) cnn.Open();
  324. sda.SelectCommand.ExecuteNonQuery();
  325. zhu1.Clear(); 
  326. sda.Fill(zhu1); 
  327. cnn.Close();
  328. DataGrid1.DataBind(); 
  329. }
  330. private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
  331. {
  332. DataGrid1.CurrentPageIndex = e.NewPageIndex;
  333. fills();
  334. }
  335. private void Button4_Click(object sender, System.EventArgs e)
  336. {
  337. p1.Visible =true;
  338.    this.Image2 .Visible =false;
  339. this.DataGrid2.Visible=true;
  340. // this.Button4.Visible=false;
  341. //            this.Button3.Visible=false;
  342. }
  343. private void Button3_Click(object sender, System.EventArgs e)
  344. {
  345. // p1.Visible =false;
  346. // Response.Redirect("bedzhao.aspx");
  347. if(cnn.State==0) cnn.Open();
  348. sda4.SelectCommand.Parameters["@num"].Value=TextBox1.Text;
  349. sda4.SelectCommand.ExecuteNonQuery ();
  350. sda31.Clear();
  351. sda4.Fill(sda31);
  352. cnn.Close();
  353. this.DataGrid2.DataBind();
  354. }
  355. private void DataGrid2_SelectedIndexChanged(object sender, System.EventArgs e)
  356. {
  357. // this.DataGrid2.CurrentPageIndex=e.NewPageIndex;
  358. // fill();
  359. }
  360. private void Button2_Click(object sender, System.EventArgs e)
  361. {
  362. if(cnn.State==0) cnn.Open();
  363. sda.UpdateCommand.Parameters["@床号"].Value=tch.Text;
  364. sda.UpdateCommand.Parameters["@挂号号码"].Value=tnum.Text;
  365. sda.UpdateCommand.Parameters["@姓名"].Value =tname.Text ;
  366. sda.UpdateCommand.Parameters ["@年龄"].Value=tage.Text ;
  367. sda.UpdateCommand.Parameters ["@性别"].Value=r1.SelectedValue ;
  368. sda.UpdateCommand.Parameters ["@级别"].Value=d1.SelectedValue ;
  369. sda.UpdateCommand.Parameters ["@负责人"].Value=d2.SelectedValue ;
  370. sda.UpdateCommand.Parameters ["@进出实况"].Value=d3.SelectedValue ;
  371. sda.UpdateCommand.ExecuteNonQuery();
  372. cnn.Close();
  373. Response.Write("<script language=javascript>alert('你已经康复,成功出院!');</script>") ;
  374. fills();
  375. fill();
  376. }
  377. private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
  378. {
  379. p1.Visible =false;
  380. this.Image2.Visible =true;
  381. // if(cnn.State==0) cnn.Open();
  382. // cmd1.Parameters["@id"].Value=Convert.ToString(DataGrid1.SelectedItem.Cells[1].Text);
  383. // SqlDataReader rd=cmd1.ExecuteReader();
  384. // while (rd.Read())
  385. // {
  386. // tch.Text =rd.GetValue(1).ToString();
  387. //
  388. // }
  389. }
  390. private void DataGrid2_SelectedIndexChanged_1(object sender, System.EventArgs e)
  391. {
  392. if(cnn.State==0) cnn.Open();
  393. cmd2.Parameters["@id"].Value=Convert.ToString(DataGrid2.SelectedItem.Cells[0].Text);
  394. SqlDataReader rd=cmd2.ExecuteReader();
  395. while (rd.Read())
  396. {
  397. tch.Text =rd.GetValue(1).ToString();
  398. tnum.Text =rd.GetValue(0).ToString();
  399. tname.Text =rd.GetValue(2).ToString();
  400. // tage.Text =rd.GetValue(4).ToString();
  401. }
  402. }
  403. private void DataGrid2_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
  404. {
  405. DataGrid2.CurrentPageIndex = e.NewPageIndex;
  406. fill();
  407. }
  408. private void Button5_Click(object sender, System.EventArgs e)
  409. {
  410. this.Response.Redirect("index.aspx");
  411. }
  412. }
  413. }