Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > [SqlException (0x80131904): Error converting data type decimal to nvarchar.]

Reply
Thread Tools

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

 
 
gvt99@hotmail.com
Guest
Posts: n/a
 
      12-22-2005
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(SqlExc eption exception,
Boolean breakConnection) +786210
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException
exception, Boolean breakConnection) +684822

System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject
stateObj) +207
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
+1751
System.Data.SqlClient.SqlDataReader.ConsumeMetaDat a() +37
System.Data.SqlClient.SqlDataReader.get_MetaData() +58
System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString) +213
System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(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(Com mandBehavior
behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteDbDataRead er(CommandBehavior
behavior) +12

System.Data.Common.DbCommand.System.Data.IDbComman d.ExecuteReader(CommandBehavior
behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(Data Set 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.Execut eSelect(DataSourceSelectArguments
arguments) +1837
System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments
arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.Perform Select() +129
System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +82

System.Web.UI.WebControls.CompositeDataBoundContro l.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>
<asparameter Direction="Output" Name="lo_met_number"
Type="Decimal" />
<asparameter Direction="Output" Name="lo_status"
Type="Int16" />
<asparameter Direction="Output" Name="blo_branch"
Type="String" />
<asparameter Direction="Output" Name="blo_processor"
Type="String" />
<asparameter Direction="Output" Name="blo_acct_exec"
Type="String" />
<asparameter Direction="Output" Name="blo_broker"
Type="String" />
<asparameter Direction="Output" Name="blo_originator"
Type="String" />
<asparameter Direction="Output" Name="blo_investor"
Type="String" />
<asparameter Direction="Output" Name="lo_lo_request"
Type="Decimal" />
<asparameter Direction="Output" Name="lo_bo_name"
Type="String" />
<asparameter 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_addr ess
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
================================================== ==============

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Value of type Decimal cannot be converted to 1 dimensional array of Decimal Neal Software 0 03-20-2011 03:08 AM
how to convert from Decimal('1.23456789') to Decimal('1.234') valpa Python 11 03-24-2009 07:11 AM
Error: Cannot convert Decimal("0.0000") to Decimal Vitaliy Python 1 05-29-2008 10:36 AM
TypeError: unsupported operand type(s) for -: 'Decimal' and 'Decimal'. Why? Gilbert Fine Python 8 08-01-2007 01:58 AM
Decimal to Packed Decimal Conversion in C++ Ven C++ 3 08-01-2006 03:56 PM



Advertisments