你的数据字段的长度有没有超出?http://vyaskn.tripod.com/programming_faq.htm#q1

解决方案 »

  1.   

    你的代码呢?可能是你的sql语句有错。
      

  2.   

    这是源码,我是从另外的窗口传递变量gh。如果gh=""表示新增人员,否则是编辑人员记录。
    以下有一个方法save(),根据情况传人不同的sqlcommand对象.
    Private Sub savebutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            If gh = "" Then
                save(SqlDataAdapter1.InsertCommand, "")
            Else
                save(SqlDataAdapter1.UpdateCommand, gh)
            End If
        End Sub
        Sub save(ByVal command As SqlClient.SqlCommand, ByVal original_gh As String)
            command.Parameters("@gh").Value = ghtxt.Text
            command.Parameters("@xm").Value = xmtxt.Text
            command.Parameters("@bmbh").Value = bmdrop.SelectedItem.Text
            command.Parameters("@hao").Value = haotxt.Text
            If xbradio.SelectedIndex = 0 Then
                command.Parameters("@xb").Value = "男"
            ElseIf xbradio.SelectedIndex = 1 Then
                command.Parameters("@xb").Value = "女"
            End If
            command.Parameters("@zb").Value = zbdrop.SelectedItem.Text
            command.Parameters("@bzf").Value = bzfdrop.SelectedItem.Text
            command.Parameters("@sfzh").Value = sfzhtxt.Text
            command.Parameters("@bz").Value = bztxt.Text
            If original_gh <> "" Then
                command.Parameters("@original_gh").Value = original_gh
            End If        SqlConnection1.Open()
            Try
                command.ExecuteNonQuery()            '出错处理
            Catch exp As SqlClient.SqlException
                If exp.Number = 2627 Then
                    message.Text = "主键不能重复!"
                Else
                    Response.Write(exp.Errors)
                    Response.Write(exp.Message)
                    Response.Write(exp.Number.ToString())                message.Text = "数据更新失败!"
                End If
            End Try
            SqlConnection1.Close()
        End Sub
      

  3.   

    各位大侠说得对。
    我代码写的有点问题,主要是下拉列表显示值和实际值的问题。
    command.Parameters("@bmbh").Value = bmdrop.SelectedItem.Text改为
    command.Parameters("@bmbh").Value = bmdrop.SelectedItem.value就好了。
    怪自己不小心,不过也懂得了8152的错误含义。
    十分感谢各位!