I
Ishtiaque Ahmed Memon
Dear All
Can anyone tell me how to save an JPEG image in a database table field?
Below is the code that I have wrote but it gives an error:
System.InvalidCastException
Object must implement IConvertible
DatabaseAccess.SqlConnection.Open()
picDataAdapter.InsertCommand = New SqlCommand("INSERT INTO TheImage(AppNo,
theImage) VALUES(@appno, @theImage)", DatabaseAccess.SqlConnection)
picDataAdapter.InsertCommand.Parameters.Add("@appno", SqlDbType.Int).Value =
AppNo
picDataAdapter.InsertCommand.Parameters.Add("@theImage", SqlDbType.Image,
7000).Value = MyImage
picDataAdapter.InsertCommand.ExecuteNonQuery()
DatabaseAccess.SqlConnection.Close()
TheImage table has two fields:
AppNo int
theImage Image
myImage is of Image type
Waiting for reply... Thanks in advance
Regards
Ishtiaque Ahmed Memon
Can anyone tell me how to save an JPEG image in a database table field?
Below is the code that I have wrote but it gives an error:
System.InvalidCastException
Object must implement IConvertible
DatabaseAccess.SqlConnection.Open()
picDataAdapter.InsertCommand = New SqlCommand("INSERT INTO TheImage(AppNo,
theImage) VALUES(@appno, @theImage)", DatabaseAccess.SqlConnection)
picDataAdapter.InsertCommand.Parameters.Add("@appno", SqlDbType.Int).Value =
AppNo
picDataAdapter.InsertCommand.Parameters.Add("@theImage", SqlDbType.Image,
7000).Value = MyImage
picDataAdapter.InsertCommand.ExecuteNonQuery()
DatabaseAccess.SqlConnection.Close()
TheImage table has two fields:
AppNo int
theImage Image
myImage is of Image type
Waiting for reply... Thanks in advance
Regards
Ishtiaque Ahmed Memon