Microsoft.ApplicationBlocks使用心得
2004-10-19 12:18
323 查看
查询返回单行ID
string sql = string.Format("select id from account where name='{0}' and password='{1}'", name, password);
object AID = SqlHelper.ExecuteScalar(CON_STR, CommandType.Text, sql);
int ID = Convert.ToInt32(AID);
插入返回新记录ID
string sql = string.Format("insert into account (name ,password) values ('{0}', '{1}'); Select CAST(@@Identity AS INTEGER)", account.Name, account.Password);
object AID = SqlHelper.ExecuteScalar(CON_STR, CommandType.Text, sql );
int id = Convert.ToInt32(AID);
查询返回多行记录
string sql = string.Format("select id, name, password from account where id={0}", id);
SqlDataReader dr = SqlHelper.ExecuteReader(CON_STR, CommandType.Text, sql);
if (dr.Read())
dr.Close();
string sql = string.Format("select id from account where name='{0}' and password='{1}'", name, password);
object AID = SqlHelper.ExecuteScalar(CON_STR, CommandType.Text, sql);
int ID = Convert.ToInt32(AID);
插入返回新记录ID
string sql = string.Format("insert into account (name ,password) values ('{0}', '{1}'); Select CAST(@@Identity AS INTEGER)", account.Name, account.Password);
object AID = SqlHelper.ExecuteScalar(CON_STR, CommandType.Text, sql );
int id = Convert.ToInt32(AID);
查询返回多行记录
string sql = string.Format("select id, name, password from account where id={0}", id);
SqlDataReader dr = SqlHelper.ExecuteReader(CON_STR, CommandType.Text, sql);
if (dr.Read())
dr.Close();
相关文章推荐
- Microsoft.ApplicationBlocks使用心得(转贴自:http://www.cnblogs.com/dannyr)
- 使用Microsoft.ApplicationBlocks.ExceptionManagement处理程序异常
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- Microsoft Application Blocks for .NET
- 使用Microsoft Web Application Stress进行压力测试
- Application.MessageBox 使用心得
- Apache log4net与EntLib Logging Application Block使用心得
- Microsoft Application Blocks for .NET学习笔记
- 使用Microsoft Web Application Stress Tool进行Web项目压力测试
- Microsoft.ApplicationBlocks.Data 中的问题
- Microsoft .NET Framework 2.0 Application Development Foundation 翻译系列3(第一章:第一课值类型的使用①)
- Microsoft .NET Framework 2.0 Application Development Foundation 翻译系列6(第一章:第二课公共引用类型的使用②)
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- (转)使用Microsoft Web Application Stress Tool对web进行压力测试
- .NET组件(Microsoft.ApplicationBlocks.Data)
- Microsoft Web Application Stress Tool 使用
- 使用Microsoft.Office.Interop.Excel.Application xlApp 生成Excel
- Android编程心得-使用Application类保存应用的全局数据
- 使用Microsoft Web Application Stress Tool对web进行压力测试