C#/Access-数据库获取自动编号的最大值
2014-03-26 17:37
323 查看
//conStrSQL你改成你的access,我这里用的SQL2005
string conStrSQL = "Data Source=xx.xx.xx.xx;Initial Catalog=xxxxx;User ID=xx;Password=xxxx";
string strSQL = "select max(自动编号字段)from table";
conn = new SqlConnection(conStrSQL);
SqlCommand cmd = new SqlCommand(strSQL, conn);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
sda.Fill(ds);
MessageBox.Show(ds.Tables[0].Rows[0][0].ToString());
http://bbs.csdn.net/topics/390400517?page=1#post-393993079
string conStrSQL = "Data Source=xx.xx.xx.xx;Initial Catalog=xxxxx;User ID=xx;Password=xxxx";
string strSQL = "select max(自动编号字段)from table";
conn = new SqlConnection(conStrSQL);
SqlCommand cmd = new SqlCommand(strSQL, conn);
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
sda.Fill(ds);
MessageBox.Show(ds.Tables[0].Rows[0][0].ToString());
http://bbs.csdn.net/topics/390400517?page=1#post-393993079
相关文章推荐
- SQL 数据类型
- 利用sqlclr实现数据库服务器端数据加密解密
- mongodb - 命令行增删改查
- MFC中使用ADO访问Oracle
- Magento sql升级脚本
- SQL优化(查询)
- MySQL的YEARWEEK函数(转)
- 必须知道的ADO.NET 数据库连接池
- .NET SqlHelper类
- SqlServer分页存储过程
- plsql Developer 设置 优化
- Oracle 中创建角色,并分配给用户
- Sybase SQL Anywhere 7 数据库修复成功
- java和oracle格式化数据的区别
- 安卓开发SQLite增删改查操作实例
- 为 MySQL 的查询结果添加排名字段
- mysql设置字符集
- 带日期备份MySQL数据库bat脚本
- SQL Server不区分大小写的问题
- 从头安装及配置PL/SQL Developer