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
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...
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
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...