0% found this document useful (0 votes)
28 views1 page

Modificar

The document declares variables to store an image from a PictureBox, convert it to a byte array, and pass it as a parameter to a stored procedure called "modificar" along with text from TextBoxes. It executes the stored procedure to update a database table and refreshes a DataGridView with updated data.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Modificar

The document declares variables to store an image from a PictureBox, convert it to a byte array, and pass it as a parameter to a stored procedure called "modificar" along with text from TextBoxes. It executes the stored procedure to update a database table and refreshes a DataGridView with updated data.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Try

Dim ms As New MemoryStream


PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
Dim arrImage() As Byte = ms.GetBuffer
Dim cm4 As New SqlCommand
cm4.CommandType = CommandType.StoredProcedure
cm4.CommandText = "modificar"
cm4.Connection = cn
Dim prr1 As New SqlParameter("@codcat", SqlDbType.Char)
Dim prr2 As New SqlParameter("@nomcat", SqlDbType.VarChar)
Dim prr3 As New SqlParameter("@descat", SqlDbType.VarChar)
Dim prr4 As New SqlParameter("@censura",
SqlDbType.VarChar)
Dim prr5 As New SqlParameter("@imagencat",
SqlDbType.Image)

prr1.Value = TextBox1.Text
prr2.Value = TextBox2.Text
prr3.Value = TextBox3.Text
prr4.Value = TextBox4.Text
prr5.Value = arrImage

cm4.Parameters.Add(prr1)
cm4.Parameters.Add(prr2)
cm4.Parameters.Add(prr3)
cm4.Parameters.Add(prr4)
cm4.Parameters.Add(prr5)

cm4.ExecuteNonQuery()
'DataGridView1.DataSource = Nothing
dt.Clear()
Dim da1 As New SqlDataAdapter("select * from categoria",
cn)
Dim dt1 As New DataTable
da1.Fill(dt1)
Me.DataGridView1.DataSource = dt1
Catch ex As Exception
MsgBox(ex.Message)
Finally

End Try

You might also like