[SqlException (0x80131904): Error converting data type decimal to nvarchar.]

G

gvt99

Hello I am new to asp.net, and need some help.

I am creating a GridView using the wizard (see code below), and I get
an error( see below),I test the stored procedure by itselfand it
works fine.

Also, when creating the datasource, I received the error "unable to
retrive schema. Ensure that the connectionstring and selectcommand
properties are valid"

Thank you for your help.

======================================================
Error
===================================================
[SqlException (0x80131904): Error converting data type decimal to
nvarchar.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection) +786210
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +684822

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +207
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
+1751
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +37
System.Data.SqlClient.SqlDataReader.get_MetaData() +58
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString) +213
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async) +570
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result) +134
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior
behavior) +12

System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +83

System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments
arguments) +1837
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments
arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +129
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82

System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
+69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1787
===============================================================
ASP.NET CODE
===============================================================

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
BackColor="LightGoldenrodYellow" BorderColor="Tan"
BorderWidth="1px" CellPadding="2"
DataSourceID="SqlDataSource1" ForeColor="Black"
GridLines="None" AutoGenerateColumns="False" Height="432px">
<FooterStyle BackColor="Tan" />
<Columns>
<asp:CommandField ButtonType="Button"
ShowSelectButton="True" />
<asp:BoundField DataField="lo_met_number"
HeaderText="MW Loan No." />
<asp:BoundField DataField="lo_status"
HeaderText="Status" />
<asp:BoundField DataField="blo_branch"
HeaderText="Branch" />
<asp:BoundField DataField="blo_processor"
HeaderText="Processor" />
<asp:BoundField DataField="blo_acct_exec"
HeaderText="Account Exec." />
<asp:BoundField DataField="blo_broker"
HeaderText="Broker" />
<asp:BoundField DataField="blo_originator"
HeaderText="Originatior" />
<asp:BoundField DataField="blo_investor"
HeaderText="Investor" />
<asp:BoundField DataField="lo_lo_request"
HeaderText="Loan No." />
<asp:BoundField DataField="lo_bo_name"
HeaderText="Borrower Name" />
<asp:BoundField DataField="lo_pro_address"
HeaderText="Property address" />
</Columns>
<PagerStyle BackColor="PaleGoldenrod"
ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue"
ForeColor="GhostWhite" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:mw_dataConnectionString1 %>"
SelectCommand="proc_sel_loans_branch"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:parameter Direction="Output" Name="lo_met_number"
Type="Decimal" />
<asp:parameter Direction="Output" Name="lo_status"
Type="Int16" />
<asp:parameter Direction="Output" Name="blo_branch"
Type="String" />
<asp:parameter Direction="Output" Name="blo_processor"
Type="String" />
<asp:parameter Direction="Output" Name="blo_acct_exec"
Type="String" />
<asp:parameter Direction="Output" Name="blo_broker"
Type="String" />
<asp:parameter Direction="Output" Name="blo_originator"
Type="String" />
<asp:parameter Direction="Output" Name="blo_investor"
Type="String" />
<asp:parameter Direction="Output" Name="lo_lo_request"
Type="Decimal" />
<asp:parameter Direction="Output" Name="lo_bo_name"
Type="String" />
<asp:parameter Direction="Output" Name="lo_pro_address"
Type="String" />
<asp:SessionParameter Name="xlo_branch"
SessionField="se_usr_id_key" Type="Int16" />
</SelectParameters>
</asp:SqlDataSource>
========================================================
Store Procedure
========================================================
USE [mw_data]
GO
/****** Object: StoredProcedure [dbo].[proc_sel_loans_branch]
Script Date: 12/21/2005 18:53:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE proc [dbo].[proc_sel_loans_branch]
@lo_met_number decimal(18,0) Output,
@lo_status smallint Output,
@blo_branch nchar(30) Output,
@blo_processor nchar(30) Output,
@blo_acct_exec nchar(30) Output,
@blo_broker nchar(30) Output,
@blo_originator nchar(30) Output,
@blo_investor nchar(30) Output,
@lo_lo_request numeric(18,0) Output,
@lo_bo_name nchar(30) Output,
@lo_pro_address nchar(30) Output,
@xlo_branch smallint

as
select @lo_met_number=lo_met_number, @lo_status= lo_status,
@blo_branch=b_description, @blo_processor=pro_name,
@blo_acct_exec=ae_name, @blo_broker=bro_name, @blo_originator=ori_name,
@blo_investor=inv_name, @lo_lo_request=lo_lo_request,
@lo_bo_name=lo_bo_name,@lo_pro_address=lo_pro_address
from
[mw_data].[dbo].[loans],[mw_data].[dbo].[branch],[mw_data].[dbo].[processor],[mw_data].[dbo].[Account_exec],[mw_data].[dbo].[broker],[mw_data].[dbo].[originator],[mw_data].[dbo].[investor]
where lo_branch = @xlo_branch
and b_id = @xlo_branch
and pro_id = lo_processor
and ae_id = lo_acct_exec
and bro_id = lo_broker
and ori_id = lo_originator
and inv_id = lo_investor

order by lo_processor,lo_acct_exec,lo_broker

GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top