由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - 关于SqlDataAdapter的初级问题求助
相关主题
ASP web application 问题请教问个问题
How to Call Stored Procedure in C# .Net?HttpWebRequest小程序
SolvedRe: 关于SqlDataAdapter的初级问题求助一个xml的问题。
foxpro and c#DALFactory in PetShop 3
visual studio为什么不加eclipse修改建议的功能listbox 的问题
ASP.NET和PHPDoes .NET have built-in Cryptography?
sqlserver express 安装后看不到内容website project
Who can tell me why i cannot connect to the SQL db file ? 心得:use XPath (+namespace)
相关话题的讨论汇总
话题: new话题: sqlcommand
进入DotNet版参与讨论
1 (共1页)
s***y
发帖数: 352
1
在程序中写下SqlDataAdapter adp = new SqlDataAdapter
编译时出错,说是
"System.Data.DataClient.SqlDataAdapter" denotes
a 'class' which is not valid in the given context.
哪位大侠知道是怎么回事?望不吝赐教。先行谢过
a********y
发帖数: 20
2

~~~~~

【在 s***y 的大作中提到】
: 在程序中写下SqlDataAdapter adp = new SqlDataAdapter
: 编译时出错,说是
: "System.Data.DataClient.SqlDataAdapter" denotes
: a 'class' which is not valid in the given context.
: 哪位大侠知道是怎么回事?望不吝赐教。先行谢过

s***y
发帖数: 352
3
您是说要加参数?请详细一点好么,谢谢了

【在 a********y 的大作中提到】
:
: ~~~~~

a********y
发帖数: 20
4
No.
I thought you forgot the "()".
C****n
发帖数: 2324
5
NBBBBBBBBBBB
连这你都能看出来. 如果我是RECRUITER, you got the job already. :-)

【在 a********y 的大作中提到】
: No.
: I thought you forgot the "()".

a********y
发帖数: 20
6
//hand.
s***y
发帖数: 352
7
But I have the "()".confused

【在 a********y 的大作中提到】
: No.
: I thought you forgot the "()".

p***n
发帖数: 635
8
did you set the parameters afterwards?

【在 s***y 的大作中提到】
: But I have the "()".confused
a********y
发帖数: 20
9
I think it must be syntax error.
The error says there is no such class in context.
BTW, please check if you have using that namespace.

【在 p***n 的大作中提到】
: did you set the parameters afterwards?
s***y
发帖数: 352
10
I have "using System.Data.Sqlclient"
and "using System.Data" and etc
Let me post the whole Page_Load method and see if there's anything wrong.
It's a really simple method though.
private void Page_Load(........)
{
SqlConnection conn = new SqlConnection(........);
SqlCommand cmd = new SqlCommand (.......);
SqlDataAdapter adp = new SqlDataAdapter(); //error this line
adp.SelectCommand = cmd;
DataSet ds = new DataSet();
adp.Fill(ds,"Database1");
...
}
Then the comile-time error occurs.

【在 a********y 的大作中提到】
: I think it must be syntax error.
: The error says there is no such class in context.
: BTW, please check if you have using that namespace.

相关主题
ASP.NET和PHP问个问题
sqlserver express 安装后看不到内容HttpWebRequest小程序
Who can tell me why i cannot connect to the SQL db file ?一个xml的问题。
进入DotNet版参与讨论
a********y
发帖数: 20
11
<%@ Page Language="C#" Debug="true" Src="adooverview2.cs"%>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="HowTo.Samples.ADONET" %>



<img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: I have "using System.Data.Sqlclient"<br />: and "using System.Data" and etc<br />: Let me post the whole Page_Load method and see if there's anything wrong.<br />: It's a really simple method though.<br />: private void Page_Load(........)<br />: {<br />: SqlConnection conn = new SqlConnection(........);<br />: SqlCommand cmd = new SqlCommand (.......);<br />: SqlDataAdapter adp = new SqlDataAdapter(); //error this line<br />: adp.SelectCommand = cmd;</span><br /></span></div></td></tr><tr><td class="zt-author">a********y<br />发帖数: 20</td><td width=80% class="zt-bg"><div id="post12" style="position:relative"><div class="zt-counter">12</div><span>namespace HowTo.Samples.ADONET<br /> {<br /> using System;<br /> using System.Data.SqlClient;<br /> public class adooverview2<br /> {<br /> public static void Main()<br /> {<br /> adooverview2 myadooverview2 = new adooverview2();<br /> myadooverview2.Run();<br /> }<br /> public void Run()<br /> {<br /> string Message = null;<br /> SqlConnection myConnection = new SqlConnection("server=(local)\\NetSDK;T<br /> rusted_Connection=yes;database=northwind");<br /> SqlCommand mySqlCommand = new SqlCommand("INSERT INTO Customers (Custome<br /> rId, CompanyName, ContactName, <br /> <br />【在 s***y 的大作中提到】<a href="#post10"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: I have "using System.Data.Sqlclient"<br />: and "using System.Data" and etc<br />: Let me post the whole Page_Load method and see if there's anything wrong.<br />: It's a really simple method though.<br />: private void Page_Load(........)<br />: {<br />: SqlConnection conn = new SqlConnection(........);<br />: SqlCommand cmd = new SqlCommand (.......);<br />: SqlDataAdapter adp = new SqlDataAdapter(); //error this line<br />: adp.SelectCommand = cmd;</span><br /></span></div></td></tr><tr><td class="zt-author">C****n<br />发帖数: 2324</td><td width=80% class="zt-bg2"><div id="post13" style="position:relative"><div class="zt-counter">13</div><span><br /> is this System.Data.DataClient.SqlDataAdapter wrong?<br /> It should be System.Data.SqlClient.SqlDataAdapter.<br /> Which version of VS do you use?<br /> You'd better paste your whole file here.<br /> I feel AsianHotty's assumption is pretty reasonable. :-)<br /> <br />【在 s***y 的大作中提到】<a href="#post1"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 在程序中写下SqlDataAdapter adp = new SqlDataAdapter<br />: 编译时出错,说是<br />: "System.Data.DataClient.SqlDataAdapter" denotes<br />: a 'class' which is not valid in the given context.<br />: 哪位大侠知道是怎么回事?望不吝赐教。先行谢过</span><br /></span></div></td></tr><tr><td class="zt-author">e***g<br />发帖数: 158</td><td width=80% class="zt-bg"><div id="post14" style="position:relative"><div class="zt-counter">14</div><span>how come a compilation be a problem, hehe</span></div></td></tr><tr><td class="zt-author">a**y<br />发帖数: 335</td><td width=80% class="zt-bg2"><div id="post15" style="position:relative"><div class="zt-counter">15</div><span><br /> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br /> I think i use System.Data.SqlClient.SqlDataAdapter<br /> <br />【在 s***y 的大作中提到】<a href="#post1"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: 在程序中写下SqlDataAdapter adp = new SqlDataAdapter<br />: 编译时出错,说是<br />: "System.Data.DataClient.SqlDataAdapter" denotes<br />: a 'class' which is not valid in the given context.<br />: 哪位大侠知道是怎么回事?望不吝赐教。先行谢过</span><br /></span></div></td></tr><tr><td class="zt-author">k*****y<br />发帖数: 221</td><td width=80% class="zt-bg"><div id="post16" style="position:relative"><div class="zt-counter">16</div><span>.NET有时候会报错行,至少我已经遇到过一次了。<br /> 明明是类型不匹配,它告诉我找不到邮CMO Object.<br /> 如果实在在那行找不到错误,最好到其他位置也看看。<br /> <br />【在 s***y 的大作中提到】<a href="#post7"><img border=0 src="/moin_static193/solenoid/img/up.png" style="vertical-align:top;"/></a><br /><span class="zt-cite">: But I have the "()".confused</span><br /></span></div></td></tr> </table></td></tr> <tr><td> <div><table class="searchpages" style="float: right"><tbody><tr> <td></td> <td>1</td> <td></td> <td>(共1页)</td> </tr> </tbody></table></div> </td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><td style="font-size:120%;text-align:center;padding-top:15px"><a href="//forum.weiming.info/c/320" style="color:#F52887;font-weight:bold;text-decoration:underline">进入DotNet版参与讨论</a></td></tr></table></td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><th colspan=2 style="color:#F52887;font-size:105%">相关主题</th></tr><tr><td width=50%>● <a href="/zhuti/DotNet/31101821/"> 心得:use XPath (+namespace)</a></td><td>● <a href="/zhuti/DotNet/15584812/">visual studio为什么不加eclipse修改建议的功能</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/31103619/">how to get reference.vb file?</a></td><td>● <a href="/zhuti/DotNet/31103527/">ASP.NET和PHP</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/31108013/">webservice 只能定义一个函数吗?</a></td><td>● <a href="/zhuti/DotNet/5224294/">sqlserver express 安装后看不到内容</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/31109037/">请问关于shared cache</a></td><td>● <a href="/zhuti/DotNet/31108123/">Who can tell me why i cannot connect to the SQL db file ?</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/4480976/">ASP web application 问题请教</a></td><td>● <a href="/zhuti/DotNet/3396349/">问个问题</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/3398522/">How to Call Stored Procedure in C# .Net?</a></td><td>● <a href="/zhuti/DotNet/3396510/">HttpWebRequest小程序</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/3396964/">SolvedRe: 关于SqlDataAdapter的初级问题求助</a></td><td>● <a href="/zhuti/DotNet/3397070/">一个xml的问题。</a></td></tr><tr><td width=50%>● <a href="/zhuti/DotNet/3398228/">foxpro and c#</a></td><td>● <a href="/zhuti/DotNet/3397332/">DALFactory in PetShop 3</a></td></tr></table></td></tr> <tr><td><table style="table-layout:fixed;width:90%;margin-left:auto;margin-right:auto"><tr><th colspan=2 style="color:#F52887;font-size:105%">相关话题的讨论汇总</th></tr><tr><td colspan=2 style="text-align:center;padding-top:10px;font-size:1.1em"><span style="margin-right: 20px"><a href="/huati/new">话题: new</a></span><span style="margin-right: 20px"><a href="/huati/sqlcommand">话题: sqlcommand</a></span></td></tr></table></td></tr> </tbody></table></div> </td></tr> </tbody></table></div> </div> <span class="anchor" id="line-3"></span><span class="anchor" id="bottom"></span></div><div id="pagebottom"></div></div><div class="sidebar"><div dir="ltr" id="SideBar.sidebar" lang="zh"><span class="anchor" id="SideBar.top"></span> <span class="anchor" id="SideBar.line-1"></span><span class="anchor" id="SideBar.line-2"></span><p class="line867"><div id="rankings"><h3>未名新帖统计<span>//&nbsp;7月16日</span></h3><div><table width=100%><tr><th width=10% align=left>#</th><th width=50% align=left>版面</th><th width=40% align=left>帖数(主题数)</th></tr><tr><td>-</td><td>全站</td><td>4871 (796)</td></tr><tr><td>1</td><td><a title="军事天地" href="/board/Military/">Military</a></td><td>3777 (569)</td></tr><tr><td>2</td><td><a title="股海弄潮" href="/board/Stock/">Stock</a></td><td>341 (51)</td></tr><tr><td>3</td><td><a title="肚皮舞运动" href="/board/Joke/">Joke</a></td><td>117 (17)</td></tr><tr><td>4</td><td><a title="史海钩沉" href="/board/History/">History</a></td><td>116 (3)</td></tr><tr><td>5</td><td><a title="车轮上的传奇" href="/board/Automobile/">Automobile</a></td><td>100 (9)</td></tr><tr><td>6</td><td><a title="美国新闻" href="/board/USANews/">USANews</a></td><td>55 (9)</td></tr><tr><td>7</td><td><a title="人到中年" href="/board/Midlife/">Midlife</a></td><td>45 (1)</td></tr><tr><td>8</td><td><a title="焦点新闻" href="/board/Headline/">Headline</a></td><td>41 (41)</td></tr><tr><td>9</td><td><a title="梦里花落知多少" href="/board/Dreamer/">Dreamer</a></td><td>33 (13)</td></tr><tr><td>10</td><td><a title="二手市场" href="/board/FleaMarket/">FleaMarket</a></td><td>32 (20)</td></tr><tr><td>11</td><td><a title="家居生活" href="/board/Living/">Living</a></td><td>30 (7)</td></tr></table><p>* 这里只显示发帖超过25的版面,努力灌水吧:-)</p></div></div> <span class="anchor" id="SideBar.line-3"></span><div id="matched_content" style="margin: 5px 2px 5px 2px"></div> <span class="anchor" id="SideBar.line-4"></span> <h3 id="SideBar.A.2BU4ZT8k4KdoROylkp-">历史上的今天</h3> <span class="anchor" id="SideBar.line-5"></span><p class="line867"><div class="BlikiSummary" style="margin-bottom:1.2em;margin-left:0.5em"><ol><li><a href="/zhuti/ChineseClassics/31268413/">faintcat妹妹看进来~~</a> 发表于12年前.</li><li><a href="/zhuti/EB23/31380293/">NSC, PD 1/7/2007, EB2, ...</a> 发表于11年前.</li><li><a href="/zhuti/FleaMarket/35696181/">[FBA求购]MJVE2 758 MJVM2 ...</a> 发表于6年前.</li><li><a href="/zhuti/Parenting/31948559/">老生常谈,归与不归</a> 发表于10年前.</li><li><a href="/zhuti/board/31486231/">【申请】Seattle西雅图 版版主——申请人...</a> 发表于9年前.</li><li><a href="/zhuti/NextGeneration/36332471/">宝宝出生,头骨骨折,求祝福</a> 发表于9年前.</li><li><a href="/zhuti/ClassicalMusic/31210935/">求推荐舒缓优美的古典音乐</a> 发表于11年前.</li><li><a href="/zhuti/PhotoGear/34338217/">百分之一的北京人上北大 中国网友愤怒(转载)</a> 发表于10年前.</li><li><a href="/zhuti/pets/31825797/">新人带狗狗Bailey来报道</a> 发表于12年前.</li><li><a href="/zhuti/Football/31468183/">全世界最有价值的运动队</a> 发表于10年前.</li><li><a href="/zhuti/Automobile/35426999/">请问大切诺基的质量如何</a> 发表于6年前.</li><li><a href="/zhuti/_RuS/23459405/">TNND,军版全是BKC</a> 发表于15年前.</li><li><a href="/zhuti/_LoTaYu/31206385/">Inception</a> 发表于12年前.</li><li><a href="/zhuti/Seattle/32526849/">微软的有些家属可真恶心,为了卖保险脸都不要了</a> 发表于10年前.</li><li><a href="/zhuti/Military/39967953/">每周坐高铁的苦逼来说说感受吧!!</a> 发表于9年前.</li></ol></div> <span class="anchor" id="SideBar.line-6"></span> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2229050667028251" crossorigin="anonymous"></script> <!-- SidebarW1 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2229050667028251" data-ad-slot="2711874079" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <span class="anchor" id="SideBar.line-7"></span><span class="anchor" id="SideBar.bottom"></span></div><div id="sidebar-end"></div></div></div><div class="footer"><span class="license">除非另有声明,本站内容采用Creative Commons BY-NC-SA 3.0协议进行许可,转载请注明来自<a href="/">未名观察</a> - <a href="/PrivacyPolicy">隐私政策</a></span><span class="time" lang="zh" dir="ltr">2011-07-24 10:06:12由<span title="admin"><a href="/admin" title="admin">admin</a></span>编辑</span> </div> <script> var _gaq=[['_setAccount','UA-18482428-3'],['_trackPageview'],['_trackPageLoadTime']]; (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; s.parentNode.insertBefore(g,s)}(document,'script')); </script> <script type="text/javascript" src="http://s.skimresources.com/js/27394X857871.skimlinks.js"></script> </body> </html>