|
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 = "Male" Then
.Item (1) .Parameters.Add (New SqlParameter ("@ sex", SqlDbType.VarChar)). Value = "Male"
Else: .Item (1) .Parameters.Add (New SqlParameter ("@ sex", SqlDbType.VarChar)). Value = "Female"
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 ("Update successful", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch sqlexc As SqlException
MessageBox.Show (sqlexc.ToString, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End If
End Sub
Let me see it. Why, I run to .Item (0) .Parameters.Add (New SqlParameter ("@ name", SqlDbType.VarChar)). Value = nametxt.Text
Prompt: Public member "Parameters" of type "String" was not found.
So painful. Who's pointing |
|