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

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

博客园 - 追忆似水年华

dotNet平台下的SNS软件的比较与选用(一) 对于IM市场的思考 杂谈DNN - 追忆似水年华 - 博客园 点评顾雏军 - 追忆似水年华 - 博客园 我要开始研究DNN了 关于《民工》 张纪中 vs 管虎 呵呵,msn7的端口修改了。 C#实现的根据年月日计算星期几的函数 记得有人说过,人生有两大欢乐,一是拥有后可以细细品味,二就是追求之中的备感充实。 install sheild调用外部函数(在dll内) 谁用过 install shield x 呀,我遇到麻烦了. 不好意思 又来问问题了. 忽然想起了刘伶 忽然想起我读书时 写的两句话 用vs制作安装程序的时候 如何获取用户输入的序列号,并进行判定 关于向页面注册javascript的技术 我读《Microsoft .NET框架程序设计(修订版)》------DoItNow的读书笔记7 也谈const VS readonly 关于键盘模拟的问题 我读《Microsoft .NET框架程序设计(修订版)》------DoItNow的读书笔记6
发现了MSDN的两个错误 不知道大家的看法如何
追忆似水年华 · 2004-06-14 · via 博客园 - 追忆似水年华

发现了MSDN的两个错误 不知道大家的看法如何

发现了MSDN的两个错误 不知道大家的看法如何

1. 关于Parameter, MSDN上说:"对于 OleDbDataAdapter 对象和 OdbcDataAdapter 对象,必须使用问号 (?) 占位符来标识参数。对于 SqlDataAdapter 对象,必须使用命名参数。"  不过我写了以下代码 (用命名参数在OleDbDataAdapter中使用)是可以通过的,难道"必须使用问号" ? 不解:(

OleDbConnection conn= new OleDbConnection(this.GetConnString());
   conn.Open();
   string sql= "select * from Forum_Class where isdel=@isdel";
   OleDbDataAdapter adapter= new OleDbDataAdapter();
   OleDbCommand comm= new OleDbCommand();
   comm.CommandText= sql;
   comm.Connection= conn;
   comm.Parameters.Add("@isdel","1");
   adapter.SelectCommand= comm;
   DataSet ds= new DataSet();
   adapter.Fill(ds,"myTable");
   conn.Close();

   this.Label1.Text= ds.Tables[0].Rows.Count.ToString();

2. 对于参数的类型 MSDN说:"可以通过将 Parameter 对象的 DbType 属性指定为特定的 System.Data.DbType,以一般的方式来指定 Parameter 的类型。此外,ADO.NET 将从 Parameter 对象的 DbType 推断 Parameter 的 .NET Framework 数据提供程序类型"  但是我按照MSDN的说法写下面的代码是无法通过的. :(

OleDbConnection conn= new OleDbConnection(this.GetConnString());
   conn.Open();
   string sql= "select * from Forum_Class where isdel=@isdel";
   OleDbCommand comm= new OleDbCommand();
   comm.CommandText= sql;
   comm.Connection= conn;
   comm.Parameters.Add("@isdel",System.Data.DbType.String,20); //M处
   comm.Parameters["@isdel"].Value= "1";
   DataSet ds= new DataSet();
   adapter.Fill(ds,"myTable");
   this.Label1.Text= comm.ExecuteScalar().ToString();
   conn.Close();

编译器提醒说在M处,无法从“System.Data.DbType”转换为“System.Data.OleDb.OleDbType”

有人对以上两点,有好的解释么? 谢谢