asp.net数据出错 [英] asp.net data error
本文介绍了asp.net数据出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从数据库到文本框中显示的数据,并不断收到以下错误。
错误1类型或命名空间名称数据表找不到(是否缺少using指令或程序集引用?)
的SqlConnection的SqlConnection =新的SqlConnection(joanton7865org7272_youthpodcastConnectionString);
的SqlConnection。开();
SqlDataAdapter的SqlDataAdapter的=新SqlDataAdapter的(从国家选择*的SqlConnection);
DataTable的DT =新的DataTable();
sqlDataAdapter.Fill(DT);
txtClubName.Text =(dt.Rows.Count大于0)? Convert.ToString(dt.Rows [0] [的ColumnName]):,;
的SqlConnection。开();
解决方案
点击数据表
键,单击鼠标右键,然后单击解析
。这会给你两个选择。其中将新增使用System.Data这;
和其他将做 System.Data.DataTable
您可以使用快捷键以及
<大骨节病>替代骨节病> + <大骨节病>移骨节病> + <大骨节病> F10 骨节病>
i am trying to display data from a database to the text box and keep getting the following error. Error 1 The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
SqlConnection sqlConnection = new SqlConnection("joanton7865org7272_youthpodcastConnectionString");
sqlConnection .Open();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("Select * from States", sqlConnection);
DataTable dt = new DataTable();
sqlDataAdapter.Fill(dt);
txtClubName.Text = (dt.Rows.Count > 0) ? Convert.ToString(dt.Rows[0]["ColumnName"]) : "";
sqlConnection .Open();
解决方案
Click on the DataTable
and right mouse click and then click Resolve
. This will give you two options. One will add using System.Data;
and the other will do System.Data.DataTable
.
You could use the shortcut as well:
Alt+Shift+F10
这篇关于asp.net数据出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文