This is a migrated thread and some comments may be shown as answers.

Image Upload

1 Answer 40 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Evelio
Top achievements
Rank 1
Evelio asked on 16 Aug 2017, 08:25 PM

I am trying to get an image to upload into sql from inside Listview. I can select the image, and it make it to the server, but when i click update i get the below error. I am able to get it working from a normal aspx page.

 

Operand type clash: tinyint is incompatible with imageDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Cannot insert the value NULL into column 'Logo', table 'FUNERALMANAGEMENTONLINE.dbo.Funeralhomes'; column does not allow nulls. UPDATE fails.
The statement has been terminated.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Logo', table 'FUNERALMANAGEMENTONLINE.dbo.Funeralhomes'; column does not allow nulls. UPDATE fails.
The statement has been terminated.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 

[SqlException (0x80131904): Cannot insert the value NULL into column 'Logo', table 'FUNERALMANAGEMENTONLINE.dbo.Funeralhomes'; column does not allow nulls. UPDATE fails. The statement has been terminated.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +2434922 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5736592 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +3731 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +225 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2026 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +375 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +337 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +280 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392 System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +670 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +106 Telerik.Web.UI.RadListView.PerformUpdate(RadListViewDataItem editedItem, Boolean suppressRebind) +289 Telerik.Web.UI.RadListViewCommandEventArgs.ExecuteCommand(Object source) +350 Telerik.Web.UI.RadListView.OnBubbleEvent(Object source, EventArgs args) +95 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 Telerik.Web.UI.RadListViewItem.OnBubbleEvent(Object source, EventArgs args) +66 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +260 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639

 

Here is the code part which is giving me the issue:

Protected Sub ruCustomerImage_FileUploaded(sender As Object, e As FileUploadedEventArgs)
        'MsgBox("ruCustomerImage_FileUploaded", MsgBoxStyle.Information, "Murasalat")
        Dim updateImage As String = ", [Logo] = @Logo"
        Dim parameter As New Parameter("Logo", System.Data.DbType.Binary)
        SqlDataSource1.UpdateParameters.Add(parameter)
        SqlDataSource1.UpdateCommand = [String].Format("UPDATE FuneralHomes SET Logo = @Logo WHERE FuneralHomeId = '1000000'", updateImage)

    End Sub

 

1 Answer, 1 is accepted

Sort by
0
Evelio
Top achievements
Rank 1
answered on 16 Aug 2017, 08:47 PM

Disregard the very start !

Operand type clash: tinyint is incompatible with imageDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Tags
ListView
Asked by
Evelio
Top achievements
Rank 1
Answers by
Evelio
Top achievements
Rank 1
Share this question
or