Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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)
     &


Ïà¹ØÎĵµ£º

C#¹ØÓÚsqlserverÖжÁÈ¡imageÀàÐÍ

½ñÌìÔÚÍøÉÏÕÒÁËÐí¾Ã¹ØÓÚsqlserverÖд洢imageÀàÐͺͶÁÈ¡imageµÄ·½·¨£¬¿ÉÊǶ¼ÊÇÄÇôһµã£¬¹ÊÔÚ´ËÂÞÁÐһϣ¬Ï£Íû¿ÉÒÔ°ïÖú´ó¼Ò¡£
Ê×ÏÈÊǹØÓÚdataGridViewµÄ°ó¶¨¡£´úÂë¼ûÏÂ
private void button_show_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; ......

ÔÚlinuxÉÏÅäÖÃunixODBCºÍFreeTDS·ÃÎÊMS SQL Server.

Ò», °²×° 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
Èç¹û°²×°ÖÐÌáʾÓжÔÆäËü° ......

SQL Server·þÎñÆ÷½ÇÉ«ÓëÊý¾Ý¿â½ÇÉ«Çø±ð

¹Ì¶¨·þÎñÆ÷½ÇÉ«
sysadmin ¿ÉÒÔÔÚ SQL Server ÖÐÖ´ÐÐÈκλ¡£
serveradmin ¿ÉÒÔÉèÖ÷þÎñÆ÷·¶Î§µÄÅäÖÃÑ¡Ï¹Ø±Õ·þÎñÆ÷¡£
setupadmin ¿ÉÒÔ¹ÜÀíÁ´½Ó·þÎñÆ÷ºÍÆô¶¯¹ý³Ì¡£
securityadmin ¿ÉÒÔ¹ÜÀíµÇ¼ºÍ CREATE DATABASE ȨÏÞ£¬»¹¿ÉÒÔ¶ÁÈ¡´íÎóÈÕÖ¾ºÍ¸ü¸ÄÃÜÂë¡£
processadmin ¿ÉÒÔ¹ÜÀíÔÚ SQL Server ÖÐÔËÐеĽø³Ì¡£
......

SqlÓï¾äѧϰ±Ê¼Ç(3) ²åÈëÊý¾Ý

ÕâÀïʹÓõÄÊý¾Ý¿âºÍÊý¾Ý±í·Ö±ðÀ´×ÔSqlÓï¾äѧϰ±Ê¼Ç£¨1£©——´´½¨Êý¾Ý¿âºÍSqlÓï¾äѧϰ±Ê¼Ç£¨2£©——´´½¨Êý¾Ý±í
use RetalDB
go
--²åÈëÊý¾Ýµ½±ítb_movie_type
insert tb_movie_type values(0,'ÆÕͨƬ','Regular')
insert tb_movie_type values(1,'ÐÂƬ','NewRelease')
insert tb_movie_type values ......

ÎÒµÄSQL֮·2

   ÖÁ½ñδÓгɾͣ¬Éõ¸ÐáÝáå¡£
   ²¢²»ÊǺÜͻȻµÄÏëѧSQL£¬¶øÊÇÔÚ֮ǰ˵µÄÄÇÑù£¬ÔÚÎÒÈÆÁËÒ»´óȦ֮ºó£¬²ÅÖªµÀ×Ô¼ºÒ²ÊÇÒ»ÎÞËùÖª£¬Í÷ѧÁËÕâô¶àÄê¡£
   ÎÒÒ»Ö±ÏëÍÑÀëѧУµÄ½ÌÓýģʽÀ´×Ôѧ£¬È»¶øÎÒ²¢²»³ÐÈÏѧУµÄ½ÌÓý·½Ê½ÊÇÒ»ÎÞËùÓõģ¬ÖÁÉÙѧµ½µÄ¶«Î÷ÊÇʵÔڵġ£´ÓѧУµÄ½Ç¶ÈÀ´¿¼ÂÇ£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ