J
Jeff07
Guest
Can't determine why this message pops up.

Here is the code.
Private Sub TransferPhotos(ByVal Acct_No As String, ByVal Facct As String)
Using cn As New SqlConnection(ConnectionString)
cn.Open()
Using cmd1 As New SqlCommand("", cn)
Using cmd2 As New SqlCommand("", cn)
cmd1.CommandText = "SELECT photo1 FROM appphotos WHERE facct = " & "'" & Acct_No & "'"
Dim arrImage1 = cmd1.ExecuteScalar()
cmd1.CommandText = "SELECT photo2 FROM appphotos WHERE facct= " & "'" & Acct_No & "'"
Dim arrImage2 = cmd1.ExecuteScalar()
cmd2.CommandText = "INSERT Into fpphotos " &
"(photo1, photo2, photo_date1, photo_date2, facct) " &
"VALUES(@photo1, @photo2, @photo_date1, @photo_date2, @facct)"
cmd2.Parameters.Add(New SqlClient.SqlParameter("@photo1", SqlDbType.Image)).Value = arrImage1
cmd2.Parameters.Add(New SqlClient.SqlParameter("@photo2", SqlDbType.Image)).Value = arrImage2
cmd2.Parameters.AddWithValue("@photo_date1", AppMain.datApproveDate.EditValue)
cmd2.Parameters.AddWithValue("@photo_date2", AppMain.datApproveDate.EditValue)
cmd2.Parameters.AddWithValue("@facct", Facct)
Try
cmd2.ExecuteNonQuery()
Catch SqlExceptionErr As SqlException
MessageBox.Show(SqlExceptionErr.Message)
End Try
End Using
End Using
End Using
End Sub
ISV using VB.net and SQL Server
Continue reading...

Here is the code.
Private Sub TransferPhotos(ByVal Acct_No As String, ByVal Facct As String)
Using cn As New SqlConnection(ConnectionString)
cn.Open()
Using cmd1 As New SqlCommand("", cn)
Using cmd2 As New SqlCommand("", cn)
cmd1.CommandText = "SELECT photo1 FROM appphotos WHERE facct = " & "'" & Acct_No & "'"
Dim arrImage1 = cmd1.ExecuteScalar()
cmd1.CommandText = "SELECT photo2 FROM appphotos WHERE facct= " & "'" & Acct_No & "'"
Dim arrImage2 = cmd1.ExecuteScalar()
cmd2.CommandText = "INSERT Into fpphotos " &
"(photo1, photo2, photo_date1, photo_date2, facct) " &
"VALUES(@photo1, @photo2, @photo_date1, @photo_date2, @facct)"
cmd2.Parameters.Add(New SqlClient.SqlParameter("@photo1", SqlDbType.Image)).Value = arrImage1
cmd2.Parameters.Add(New SqlClient.SqlParameter("@photo2", SqlDbType.Image)).Value = arrImage2
cmd2.Parameters.AddWithValue("@photo_date1", AppMain.datApproveDate.EditValue)
cmd2.Parameters.AddWithValue("@photo_date2", AppMain.datApproveDate.EditValue)
cmd2.Parameters.AddWithValue("@facct", Facct)
Try
cmd2.ExecuteNonQuery()
Catch SqlExceptionErr As SqlException
MessageBox.Show(SqlExceptionErr.Message)
End Try
End Using
End Using
End Using
End Sub
ISV using VB.net and SQL Server
Continue reading...