摘要: 写了一段代码,内容是打开工程中的文本文件,写入数据,关键代码如下:1 StreamResourceInfo filename = Application.GetResourceStream(new Uri("answers.txt", UriKind.Relative));2 using (StreamWriter writer = new StreamWriter(filename.Stream))3 {4 writer.WriteLine(inputStr);5 wr... 阅读全文
posted @ 2012-10-20 10:55 技术_菜鸟 阅读(368) 评论(0) 推荐(1) 编辑
摘要: 贴出错误提示代码【节选】:Context initialization failedorg.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid;nested exception is org.xml.sax.SAXParseException: The reference to entity "character 阅读全文
posted @ 2012-09-14 19:45 技术_菜鸟 阅读(680) 评论(0) 推荐(0) 编辑
摘要: ViewData和TempData是字典类型,赋值方式用字典方式, ViewData["myName"]ViewBag是动态类型,使用时直接添加属性赋值即可 ViewBag.myNameViewBag和ViewData只在当前Action中有效,等同于ViewTempData可以通过转向继续使用,因为它的值保存在Session中。但TempData只能经过一次传递,之后会被系统自动清除ViewData和ViewBag 中的值可以互相访问,因为ViewBag的实现中包含了ViewData 阅读全文
posted @ 2012-09-06 16:33 技术_菜鸟 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1 <?xml version='1.0' encoding='UTF-8'?> 2 <!DOCTYPE hibernate-configuration PUBLIC 3 "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 5 6 <!-- Generated by MyEclipse Hibernate 阅读全文
posted @ 2012-09-05 09:16 技术_菜鸟 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 1、自动增长identity适用于MySQL、DB2、MS SQL Server,采用数据库生成的主键,用于为long、short、int类型生成唯一标识使用SQL Server 和 MySQL 的自增字段,这个方法不能放到 Oracle 中,Oracle 不支持自增字段,要设定sequence(MySQL 和 SQL Server 中很常用)数据库中的语法如下:MySQL:create table t_user(id int auto_increment primary key, name varchar(20));SQL Server:create table t_user(id int 阅读全文
posted @ 2012-09-04 19:16 技术_菜鸟 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 在开发hibernate的程序时,需要进行SessionFactory的配置,简单地说,也就是建立与数据库之间连接的配置,在hibernate中一般使用xml文件来进行配置,但是在该文件的配置中需要设置dialect方言属性值,对于不同的数据库,方言的值dialect是不同的,那么下面就列出在不同的数据库中如何设置该dialect值(参见下表):RDBMS方言DB2org.hibernate.dialect.DB2DialectDB2 AS/400org.hibernate.dialect.DB2400DialectDB2 OS390org.hibernate.dialect.DB2390D. 阅读全文
posted @ 2012-09-04 15:52 技术_菜鸟 阅读(668) 评论(0) 推荐(0) 编辑
摘要: 格式规范的完整形式:{index [,width][:formatstring]}index是此格式程序引用的格式字符串之后的参数,从零开始计数;width(可选) 是要设置格式的字段的宽度,width取正数表示结果右对齐,取负数表示结果左对齐;formatstring(可选),包含有关设置类型格式的格式说明。一.内置类型的字母格式1. E-科学计数法表示 25000.ToString("E");//结果:2.500000E+0042. C-货币表示,带有逗号分隔符,默认小数点后保留两位,四舍五入 2.5.ToString("C");//结果:¥2.50 阅读全文
posted @ 2012-08-30 21:13 技术_菜鸟 阅读(265) 评论(0) 推荐(0) 编辑