NoteDA.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:3k
源码类别:

.net编程

开发平台:

Others

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. namespace qminoa.DA.Schedule
  5. {
  6. public class NoteDA
  7. {   
  8. private String conn=System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString");
  9. private SqlDataAdapter objadapter = new SqlDataAdapter();
  10. private DataSet objdataset = new DataSet();
  11. public NoteDA()
  12. {
  13. }
  14.     
  15. public DataSet noteread(int EmpID)
  16. {
  17. SqlCommand objcommand = new SqlCommand();
  18. objadapter.SelectCommand = new SqlCommand(); 
  19. objadapter.SelectCommand.Connection = new SqlConnection(conn);
  20. objcommand = objadapter.SelectCommand;
  21.             objcommand.CommandText = "cpNoteBind";
  22. objcommand.CommandType = CommandType.StoredProcedure;
  23. SqlParameter param = new SqlParameter("@EmpID", SqlDbType.Int);
  24. param.Value = EmpID;
  25.   objcommand.Parameters.Add(param); 
  26. objadapter.Fill(objdataset,"note5");
  27. return objdataset;
  28. }
  29. public SqlCommand notefill(int NoteID)
  30. {
  31. SqlCommand objcommand = new SqlCommand();
  32. objadapter.SelectCommand = new SqlCommand(); 
  33. objadapter.SelectCommand.Connection = new SqlConnection(conn);
  34. objcommand = objadapter.SelectCommand;
  35. objcommand.CommandText = "cpNoteRead";
  36. objcommand.CommandType = CommandType.StoredProcedure; 
  37. objcommand.Parameters.Add(new SqlParameter("@NoteID", SqlDbType.Int));
  38. objcommand.Parameters["@NoteID"].Value=NoteID;
  39. return objcommand;
  40. }
  41.         
  42. public void notedelete(int NoteID)
  43. {
  44. SqlCommand objcommand = new SqlCommand();
  45. objcommand.Connection =new SqlConnection(conn);  
  46. objcommand.CommandText = "cpNoteDel";
  47. objcommand.CommandType = CommandType.StoredProcedure; 
  48. objcommand.Parameters.Add(new SqlParameter("@NoteID",SqlDbType.Int));
  49. objcommand.Parameters["@NoteID"].Value=NoteID;
  50. objcommand.Connection.Open();
  51. objcommand.ExecuteNonQuery();
  52. objcommand.Connection.Close();
  53. }
  54. public void noteaddup(int NoteID,int EmpID,string Content,DateTime CDate)
  55. {
  56. SqlCommand objcommand = new SqlCommand();
  57. objcommand.Connection =new SqlConnection(conn);  
  58. objcommand.CommandText = "cpNoteAddUp";
  59. objcommand.CommandType = CommandType.StoredProcedure; 
  60. objcommand.Parameters.Add(new SqlParameter("@NoteID",SqlDbType.Int));
  61. objcommand.Parameters["@NoteID"].Value=NoteID;
  62. objcommand.Parameters.Add(new SqlParameter("@EmpID",SqlDbType.Int));
  63. objcommand.Parameters["@EmpID"].Value=EmpID;
  64. objcommand.Parameters.Add(new SqlParameter("@Content",SqlDbType.NVarChar,100));
  65. objcommand.Parameters["@Content"].Value=Content;
  66. objcommand.Parameters.Add(new SqlParameter("@CDate",SqlDbType.DateTime));
  67. objcommand.Parameters["@CDate"].Value=CDate;
  68. objcommand.Connection.Open();
  69. objcommand.ExecuteNonQuery();
  70. objcommand.Connection.Close();
  71. }
  72. }
  73. }