Let me start by saying I am fairly new to this and sorry if its obvious I have been trying to find an answer for a couple of days!
I am trying to insert a byte[] into a varbinary in my database but am hitting a brick wall, so I hope someone can help. So far I have:
Dim biData, matchId
Dim sConnString, connection, recordset, sql, count
biData = Request.BinaryRead(Request.TotalBytes)
matchId = Request.ServerVariables("QUERY_STRING")
sql = "SELECT * FROM MatchData WHERE matchId= '" & matchId & "'"
'define the connection string, specify database
'driver and the location of database
sConnString="Driver={SQL Server};<CONNECTIONSTRING>"
Set connection = Server.CreateObject("ADODB.Connection")
Set recordset = Server.CreateObject("ADODB.Recordset")
'Open the connection to the database
connection.Open(sConnString)
'Open the recordset object executing the SQL
recordset.Open sql, connection,3,3
count=recordset.recordcount
If count > 0 Then
response.Write("Found ")
recordset.Update "MatchId", matchId
'MY PROBLEM IS HERE
'recordset.Update "MatchData", biData
'recordset.Fields("MatchData").AppendChunk biData
Else
response.Write("Not Found ")
recordset.AddNew "MatchId", matchId
'MY PROBLEM IS ALSO HERE
'recordset.Update "MatchData", biData
'recordset.Fields("MatchData").AppendChunk(biData)
End If
recordset.Close
Set recordset=Nothing
'Done. Close the connection object
connection.Close
Set connection = Nothing
If I just return the biData then I see the exact byte[] I uploaded so I guess its there i.e. response.BinaryWrite biData
Thanks in advance for any answers