IBatisNet SQL ServerµÄfloatÀàÐÍת»»Îªc# float³ö´í
½ñÌìдһ¸öÉÌÆ·µÄÐ޸ŦÄÜʱÓöµ½µÄÎÊÌâ
ÉÌÆ·ÖÐÖØÁ¿ weight µÄÊý¾Ý¿â(SQL Server2005)ÀàÐͶ¨ÒåΪ float
ÔÚmappings ÖÐת»»Îªc#ÀàÐ͵ÄÒ»¾äΪ
<result property="Goods_Weight" column="Goods_Weight" type="float" dbType="float"/>
°´Àí˵Õâ¸ö float ÊÇÒ»ÑùµÄ£¬×ª»»ÍêÈ«²»»á³öÏÖÎÊÌ⣬
ʵ¼Ê³ÌÐòÔËÐÐʱ£¬ÏµÍ³±¨´í
²¶×½µ½ System.InvalidCastException
Message="Ö¸¶¨µÄת»»ÎÞЧ¡£"
Source="System.Data"
StackTrace:
ÔÚ System.Data.SqlClient.SqlBuffer.get_Single()
ÔÚ System.Data.SqlClient.SqlDataReader.GetFloat(Int32 i)
ÔÚ IBatisNet.DataMapper.Commands.DataReaderDecorator.System.Data.IDataRecord.GetFloat(Int32 i)
ÔÚ IBatisNet.DataMapper.TypeHandlers.SingleTypeHandler.GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
ÔÚ IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty.GetDataBaseValue(IDataReader dataReader)
ÔÚ IBatisNet.DataMapper.MappedStatements.ResultStrategy.AutoMapStrategy.Process(RequestScope request, IDataReader& reader, Object resultObject)
ÔÚ IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultClassStrategy.Process(RequestScope request, IDataReader& reader, Object resultObject)
ÔÚ IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(RequestScope request, ISqlMapSession session, Object parameterObject, Object resultObject)
ÔÚ IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session, Object parameterObject, Object resultObject)
ÔÚ IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(ISqlMapSession session, Object parameterObject)
&
Ïà¹ØÎĵµ£º
˼·:SQLÀᄀ¿ÉÄܵIJÉÓÃÁ½¸öÒýºÅ±ÕºÏ±äÁ¿;¶Ô±äÁ¿ÖеÄÒýºÅתÒå;¶Ô²»ÄܲÉÓÃ2¸öÒýºÅ±ÕºÏµÄ±äÁ¿,ÏÈÔ¤ÏÈÅжϱäÁ¿ÀàÐÍ;
·½°¸:
1 ËùÓзÇÊýÖµÔËËã(Èç×Ö·û,¼òµ¥ÊýÖµÐ͵ȵÈ)µÄSQL±äÁ¿¶¼¼ÓÒýºÅ;
2 ËùÓзÇÊýÖµÔËËãµÄSQL±äÁ¿µÄÖµ¶¼²ÉÓÃmagic_quotes_gpc» ......
ÎÊÌâÃèÊö£º
C#³ÌÐò,ÀïÃæcopyÁËÐí¶àÔÀ´µÄ´úÂë,ËùÒԲβÆëµÄ,ºÜÄѶÁ,ÈçºÎ²ÅÄÜÈôúÂë×Ô¶¯ÅÅÆë,¾ÍÏóVS 6.0ÖпÉÒÔʹÓÿì½Ý¼ü,·Ç³£·½±ã.
½â´ð£º
ctrl+a,ÏÈÈ«Ñ¡
ctrl+k,ctrl+f,×Ô¶¯ÅÅÁÐ
»òÕß
ctrl+a,ÏÈÈ«Ñ¡
alt+F8 ×Ô¶¯ÅÅÁÐ ......
Ò», °²×° unixODBC
ÏÂÔØ°²×°°ü. ÔÚ RedHat °²×°¹âÅÌÉϾÍÓÐ
unixODBC-2.2.11-1.RHEL4.1.i386.rpm
unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
unixODBC-kde-2.2.11-1.RHEL4.1.i386.rpm
°²×°
rpm -Uvh unixODBC-2.2.11-1.RHEL4.1.i386.rpm
rpm -Uvh unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
Èç¹û°²×°ÖÐÌáʾÓжÔÆäËü° ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[sp_GetRecordfromPage]
@TableName varchar(350), --±íÃû
@Fields varchar(5000) = '*', --×Ö¶ÎÃû(È«²¿×Ö¶ÎΪ*)
@OrderField varchar(5000), &nbs ......
1£ºµ± SQL Óï¾äÒýÓ÷ÇË÷ÒýÊÓͼʱ£¬·ÖÎöÆ÷ºÍ²éѯÓÅ»¯Æ÷½«·ÖÎö SQL Óï¾äµÄÔ´ºÍÊÓͼµÄÔ´£¬È»ºó½«ËüÃǽâÎöΪµ¥¸öÖ´Ðмƻ®¡£Ã»Óе¥¶ÀÓÃÓÚ SQL Óï¾ä»òÊÓͼµÄ¼Æ»®¡£
2£ºË÷ÒýÊÓͼµÄÐÐÒÔ±íµÄ¸ñʽ´æ´¢ÔÚÊý¾Ý¿âÖС£Èç¹û²éѯÓÅ»¯Æ÷¾ö¶¨Ê¹Óòéѯ¼Æ»®µÄË÷ÒýÊÓͼ£¬ÔòË÷ÒýÊÓͼ½«°´ÕÕ»ù±íµÄ´¦Àí·½Ê½½øÐд¦Àí ......