惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 青青木

ASP.net2.0把word、excel转换成Html(转) 在三层交换机上开专线IP的方法 [转]静态框架导航,左侧折叠树的样式,类似于treeview 在ASP.NET中使用FCKEditor的简单配置方法 Matlab与Access数据库的连接 [转]用matlab做聚类分析 Word 2003特殊符号录入与编辑(转) C++内存分配的五种的区别(转) C#中正则表达式的完全匹配 asp.net定义用户控件时,属性持久化和如何动态加载的问题 命名空间“Microsoft office”中不存在类型或命名空间名称“Interop” GridView相应模板列中的LinkButton按钮的事件 visual studio 2005 和 sql server 2005 安装时需要注意的事项 使用ConfigurationManager需要在.net引用中添加System.Configuration引用 还原数据库后,用户名出错,不能修改用户属性 DataView设置datasource后,需要databind() asp.net中重命名网页的一种方法 C++语言中的虚函数 vc中出现“没有找到mspdb60.dll文件”时 ,解决方法
插入SQL语句后,返回刚插入记录的ID
青青木 · 2008-08-28 · via 博客园 - 青青木

执行完sql(insert)后  用@@identity  返回刚插入记录ID

1 string strSql = "INSERT INTO tablename ( number, vmoney, money)  VALUES  ('1', 1, 1);

select @@identity";
2 using (SqlDataObject sdo = new SqlDataObject())
3 {
4      object o = sdo.ExecuteScalar(strSql);
5      if (o != null)
6          lblID.Text = o.ToString();
7  }

其中SqlDataObject是自己写的执行SQL的类。

posted @ 2008-08-28 21:25  青青木  阅读(6527)  评论(0)    收藏  举报

刷新页面返回顶部