Last post Sep 04, 2015 01:43 AM by Klein Zhang
None
0 Points
2 Posts
Sep 03, 2015 10:50 AM|DaveBF3|LINK
This is a variation on a question I asked earlier.
I have a SQLDataSource1 and a InsertParameter called AttachmentData of type "DBType=Binary".
I want to load the parameter from a Byte array called Buffer. Dim Buffer as Byte().
this works from inside an Inserting event:
e.command.parameters("@AttachmentData").value = Buffer
But I need to do it from a prior event so I'm trying this.
SQLDataSource1.InsertParameters("AttachmentData").defaultvalue = Buffer
It gives the error:
Value of type "1-dimensional array of Byte' cannot be converted to 'String'.
What can I do?
Star
8460 Points
1445 Posts
Sep 04, 2015 01:43 AM|Klein Zhang|LINK
Hi DaveBF3
DaveBF3 SQLDataSource1.InsertParameters("AttachmentData").defaultvalue = Buffer
SqlDataSource1.InsertParameters("AttachmentData").DefaultValue need type of string, but the Buffer is a byte array. You could only enter string type value to the DefaultValue.
DefaultValue: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.parameter.defaultvalue(v=vs.110).aspx
Best Regards
Klein zhang
None
0 Points
2 Posts
How to set a SQLDataSource InsertParameter default value of type DBType=Binary
Sep 03, 2015 10:50 AM|DaveBF3|LINK
This is a variation on a question I asked earlier.
I have a SQLDataSource1 and a InsertParameter called AttachmentData of type "DBType=Binary".
I want to load the parameter from a Byte array called Buffer. Dim Buffer as Byte().
this works from inside an Inserting event:
e.command.parameters("@AttachmentData").value = Buffer
But I need to do it from a prior event so I'm trying this.
SQLDataSource1.InsertParameters("AttachmentData").defaultvalue = Buffer
It gives the error:
Value of type "1-dimensional array of Byte' cannot be converted to 'String'.
What can I do?
Star
8460 Points
1445 Posts
Re: How to set a SQLDataSource InsertParameter default value of type DBType=Binary
Sep 04, 2015 01:43 AM|Klein Zhang|LINK
Hi DaveBF3
SqlDataSource1.InsertParameters("AttachmentData").DefaultValue need type of string, but the Buffer is a byte array. You could only enter string type value to the DefaultValue.
DefaultValue: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.parameter.defaultvalue(v=vs.110).aspx
Best Regards
Klein zhang