AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Expert: Syed Rizwan Muhammad Rizvi Date: 11/11/2006 Subject: Error = Only byte array and strings can be serialize by MySqlBinary
Question The below code is my save code
Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
Dim myCommand As New MySqlCommand
Dim txn As MySqlTransaction
Dim strcolorfcov As String
Dim strcolorbcov As String
Dim strcolorfcon1 As String
Dim strcolorbcon1 As String
Dim strcolorfcon2 As String
Dim strcolorbcon2 As String
Dim strcolorfcon3 As String
Dim strcolorbcon3 As String
Dim strcolorfrontcover As String
Dim strcolorbackcover As String
Dim strcolorfrontcontent As String
Dim strcolorbackcontent As String
Dim strfinishing As String
Dim strReference As String
Dim strjobno As String
Dim strentity As String
Dim strothrfcolorcov As String
Dim strothrbcolorcov As String
Dim strothrfcolorcon1 As String
Dim strothrbcolorcon1 As String
Dim strothrfcolorcon2 As String
Dim strothrbcolorcon2 As String
Dim strothrfcolorcon3 As String
Dim strothrbcolorcon3 As String
Dim strfname As String = ""
Dim strfname1 As String = ""
If chkvarnish.Checked = True Then
strVarnish = " Varnish"
If chkuv.Checked = True Then
strUV = " (UV)+"
ElseIf chkspot.Checked = True Then
strUV = " (SpotUV)+"
Else
strUV = " (Overpoint"
If chkfront.Checked = True Then
strFront = " (Front))+"
Else
strFront = " (Back))+"
End If
End If
Else
End If
If chkhotstamping.Checked = True Then
strHotStamping = "Hot Stampig"
If chkhotblock.Checked = True Then
strBlock = " (Block Ready)+"
Else
strBlock = " (New Block)+"
End If
Else
End If
If chkemboss.Checked = True Then
strEmboss = " Emboss"
If chkembossblock.Checked = True Then
strNew = " (Block Ready)+"
Else
strNew = " (New Block)+"
End If
Else
End If
If chkdiecut.Checked = True Then
strDieCutting = " Die Cutting"
If chkdiemould.Checked = True Then
strMould = " (Mould Ready)+"
Else
strMould = " (New Mould)+"
End If
Else
End If
If chkfold.Checked = True Then
strFolding = " Folding"
If chkhand.Checked = True Then
strHand = " (Hand)+"
Else
strHand = " (Machine)+"
End If
End If
If chkcreasing.Checked = True Then
strCreasing = " Creasing"
Else
End If
If chkglue.Checked = True Then
strGlue = " Gluing"
If chkghand.Checked = True Then
strGhand = " (Hand)+"
Else
strGhand = " (Machine)+"
End If
End If
If chkstitch.Checked = True Then
strStitch = " Center Stitching"
Else
End If
If chklaminate.Checked = True Then
strLaminate = " Laminate"
If chkmatt.Checked = True Then
strMatt = " (Matt Laminate"
If chkmattfront.Checked = True Then
strMattFront = " (Front))+"
Else
strMattFront = " (Back))+"
End If
Else
strMatt = " (Gloss Laminate"
If chkmattfront.Checked = True Then
strGloss = " (Front))+"
Else
strGloss = " (Front))+"
End If
End If
Else
End If
If chkstring.Checked = True Then
strString = " Stringing"
Else
End If
If chkpunch.Checked = True Then
strPunch = " Punching"
If chk3mm.Checked = True Then
str3mm = " (3mm)+"
Else : str3mm = " (6mm)+"
End If
End If
If chkother.Checked = True Then
strOther = " Other ( refer remarks )"
Else
End If
If chkkeep.Checked = True Then
strKeep = "Keep Plate +"
Else
End If
If chkagent.Checked = True Then
strAgent = " Agent"
Else
End If
If chkinv.Checked = True Then
myCommand.Parameters.Add("?inv", "1")
Else
myCommand.Parameters.Add("?inv", "0")
End If
If chkurgent.Checked = True Then
myCommand.Parameters.Add("?Refer", "Urgent")
ElseIf chkemerg.Checked = True Then
myCommand.Parameters.Add("?Refer", "Emergency")
Else : chkemerg.Checked = True
myCommand.Parameters.Add("?Refer", txtrefer.Text)
End If
If chkcs.Checked = True Then
myCommand.Parameters.Add("sideCover", "S" & txtcs.Text)
Else
myCommand.Parameters.Add("sideCover", "B" & txtcbs.Text)
End If
If chkcos.Checked = True Then
myCommand.Parameters.Add("sideCNT", "S" & txtcos.Text)
Else
myCommand.Parameters.Add("sideCNT", "B" & txtcob.Text)
End If
If chkloose.Checked = True Then
myCommand.Parameters.Add("?Qty", txtqty.Text)
Else
myCommand.Parameters.Add("?Qty", txtqtyb.Text)
'myCommand.Parameters.Add("?Set", txtset.Text)
End If
Catch myerror As Exception
MsgBox("There was an error reading from from the database: " & myerror.Message)
End Try
problem is weh ni din select anything, it still save the data cause the combo box display a data.
THANK YOU FOR ANSWERING MY QUESTION N ALSO HELPING ME,
-------------------------------------------
The text above is a follow-up to ...
-----Question-----
First of all thanks to you for the help.
when i save my data it pop up a message that is Error = Only byte array and strings can be serialize by MySqlBinary
what is it mean and how do i solve it
thanks
-----Answer-----
pls. paste the code that is causing this error, so I can have a look. Most probably you are trying to use a Command object to save data and parameter's data type are not set correctly.
Answer OK, checked through the code, didnt find anything wrong, perhaps there is a mismatch between datatype defined in the database and type of value of provided in your code its a good practice to create parameters with strict datatypes defined, e.g. MySqlParameter projidParm = new MySqlParameter("?ProjectId",
MySqlDbType.UInt32,4,"ProjectId") and then add projidParm to command.parameters collection using add method, kindly let me know if that helps.