|
Private Sub updata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updata.Click
imagepath = Application.StartupPath + "\face\" + data.Tables(0).Rows(0).Item(6) + ".bmp"
a = a.FromFile(imagepath)
Else
Try
Dim strsql As String = "update cardinfo set(name=@name,old=@old,number=@number,address=@address,mail=@mail)"
Dim strcmd As New SqlCommand(strsql, sqlconn)
With data.Tables(0).Rows(0)
.Item(0).Parameters.Add(New SqlParameter("@name", SqlDbType.VarChar)).Value = nametxt.Text
.Item(2).Parameters.Add(New SqlParameter("@old", SqlDbType.Int)).Value = old.Text
.Item(4).Parameters.Add(New SqlParameter("@number", SqlDbType.VarChar)).Value = number.Text
If man.Checked.ToString = "男" Then
.Item(1).Parameters.Add(New SqlParameter("@sex", SqlDbType.VarChar)).Value = "男"
Else : .Item(1).Parameters.Add(New SqlParameter("@sex", SqlDbType.VarChar)).Value = "女"
End If
.Item(3).Parameters.Add(New SqlParameter("@address", SqlDbType.VarChar)).Value = address.Text
.Item(5).Parameters.Add(New SqlParameter("@mail", SqlDbType.VarChar)).Value = mail.Text
End With
strcmd.CommandType = CommandType.Text
sqlconn.Open()
strcmd.ExecuteNonQuery()
strcmd.CommandType = CommandType.Text
cardada.SelectCommand = strcmd
cardada.Update(data)
sqlconn.Close()
MessageBox.Show("更新成功", "状态", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch sqlexc As SqlException
MessageBox.Show(sqlexc.ToString, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End If
End Sub
大家帮我看下。为什么,我运行到.Item(0).Parameters.Add(New SqlParameter("@name", SqlDbType.VarChar)).Value = nametxt.Text
提示未找到类型“String”的公共成员“Parameters”。
好痛苦啊。哪位指点下 |
|