 
										
					
	 
										
					
	 
										
					
	 2006-05-27 13:35
	    2006-05-27 13:35
  建立一个连接并打开,声明产生一个命令,在数据库端做三个存储过程,分别是增加,修改,删除,执行时用命令调用存储过程就行了,源代码实在太多,懒得敲入,只能告诉方法了,哈哈哈。
 2006-05-28 11:36
	    2006-05-28 11:36
   2006-06-04 17:18
	    2006-06-04 17:18
   2006-06-06 10:50
	    2006-06-06 10:50
   
添加:If MessageBox.Show("确定添加该信息!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = DialogResult.Yes Then
Dim cmd As New SqlCommand("insert into 表名(员工编号,员工姓名,取得日期,职称,取得方式,聘用单位,聘用技术职务,聘用起始日期,聘用结束日期,职称英语,职称英语取得日期,职称电脑,职称电脑取得日期,备注) values('" & ComboBox1.Text & " ','" & ComboBox2.Text & " ','" & DateTimePicker1.Text & "','" & ComboBox3.Text & " ','" & ComboBox4.Text & " ','" & ComboBox5.Text & " ','" & TextBox1.Text & " ',@聘用起始日期,@聘用结束日期,'" & ComboBox6.Text & " ',@职称英语取得日期,'" & ComboBox7.Text & " ',@职称电脑取得日期,'" & TextBox2.Text & " ')", conStr)
                        Dim cmd3 As New SqlCommand("select count(*) from 员工信息 where 员工编号='" & ComboBox1.Text & "' and  姓名='" & ComboBox2.Text & "'", conStr)
                        conStr.Open()
                        If cmd3.ExecuteScalar = 0 Then
                            MsgBox("员工ID与员工姓名与之前登记的不一致!请确认后,重新输入!")
                        Else
                            'cmd.Parameters.Add("@取得日期", SqlDbType.DateTime, 8)
                            cmd.Parameters.Add("@聘用起始日期", SqlDbType.DateTime, 8)
                            cmd.Parameters.Add("@聘用结束日期", SqlDbType.DateTime, 8)
                            cmd.Parameters.Add("@职称英语取得日期", SqlDbType.DateTime, 8)
                            cmd.Parameters.Add("@职称电脑取得日期", SqlDbType.DateTime, 8)
                            'cmd.Parameters("@取得日期").Value = DateTimePicker1.Text
                            cmd.Parameters("@聘用起始日期").Value = DateTimePicker2.Text
                            cmd.Parameters("@聘用结束日期").Value = DateTimePicker3.Text
                            cmd.Parameters("@职称英语取得日期").Value = DateTimePicker4.Text
                            cmd.Parameters("@职称电脑取得日期").Value = DateTimePicker5.Text
                            cmd.ExecuteNonQuery()
                            Dim da As New SqlDataAdapter("select * from 员工职称 ", conStr)
                            Dim f6 As New 职称列表
                            ds.Clear()
                            da.Fill(ds, "员工职称")
                            f6.DataGrid1.SetDataBinding(ds, "员工职称")
                            MsgBox("恭喜你!保存成功!")
                            conStr.Close()
                        End If
                    End If
删除:   If MessageBox.Show("确定删除该数据?删除该数据,数据将永久丢失,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = DialogResult.Yes Then
                        Dim cmd As New SqlCommand("delete 员工职称 where 编号='" & TextBox3.Text & "'", conStr)
                        Dim cmd1 As New SqlCommand("select count(*) from 员工职称 where 编号='" & TextBox3.Text & "'", conStr)
                        conStr.Open()
                        If cmd1.ExecuteScalar = 1 Then
                            cmd.ExecuteNonQuery()
  MsgBox("恭喜你!删除成功!!!")
                        Else
                            MessageBox.Show("对不起!删除失败,请重新设置!")
                        End If
                        conStr.Close()
                    End If
  conStr.Open()
                    Dim cmd2 As New SqlCommand("update 员工职称 set 员工姓名='" & ComboBox2.Text & "',取得日期='" & DateTimePicker1.Text & "',职称='" & ComboBox3.Text & "',取得方式='" & ComboBox4.Text & "',聘用单位='" & TextBox1.Text & "',聘用技术职务='" & ComboBox5.Text & "',聘用起始日期='" & DateTimePicker2.Text & "',聘用结束日期='" & DateTimePicker3.Text & "',职称英语='" & ComboBox6.Text & "',职称英语取得日期='" & DateTimePicker4.Text & "',职称电脑='" & ComboBox7.Text & "',职称电脑取得日期='" & DateTimePicker5.Text & "',备注='" & TextBox2.Text & "'where 编号='" & TextBox3.Text & "'", conStr)
                    'Dim cmd3 As New SqlCommand("select count(*) from 员工职称 where 员工编号='" & TextBox3.Text & "'", conStr)
                    'If cmd3.ExecuteScalar = 1 Then
                    cmd2.ExecuteNonQuery()
                    Dim da As New SqlDataAdapter("select * from 员工职称 ", conStr)
                    Dim f6 As New 职称列表
                    ds.Clear()
                    da.Fill(ds, "员工职称")
                    f6.DataGrid1.SetDataBinding(ds, "员工职称")
                    MsgBox("恭喜你!修改成功!")
                    'End If
                    conStr.Close()
 2006-06-06 10:59
	    2006-06-06 10:59
   2006-06-08 17:40
	    2006-06-08 17:40
   2006-06-11 16:37
	    2006-06-11 16:37