null value to image in norwind sample database category table

  • Thread starter Thread starter muhammadanzar
  • Start date Start date
M

muhammadanzar

Guest
hi


i insert data in the category of norwind sample database. My requirement is via vb.net i insert null value in image

when i code, i got this error message

1581508.png

my code is

Dim photoParam As New SqlParameter("@photo", SqlDbType.Image)
photoParam.Value = DBNull.Value
Using connection As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True")
Using command As New SqlCommand("INSERT INTO [Northwind].[dbo].[Categories] ([CategoryName],[Description],[Picture]) VALUES(@CategoryName, @Description, @Picture)", connection)
command.Parameters.AddWithValue("@CategoryName", TextBox1.Text)
command.Parameters.AddWithValue("@Description", TextBox1.Text)
command.Parameters.AddWithValue("@Picture", photoParam)
Try
connection.Open()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Data Save in Database", "Read Message Carefully", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)
ShowData()
End If
connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally

End Try
End Using
End Using


thanks



MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959

Continue reading...
 

Similar threads

M
Replies
0
Views
146
muhammadanzar
M
M
Replies
0
Views
176
muhammadanzar
M
M
Replies
0
Views
128
muhammadanzar
M
M
Replies
0
Views
133
muhammadanzar
M
Back
Top