各位师傅请看下面代码:"找不到类型或命名空间名称“SqlConnetion”(是否缺少 using 指令或程序集引用?)",请指点指点.
using System;using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnetion cn;
protected void Page_Load(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings["CMSConnectionString"];
cn = new SqlConnetion(strconn);
if (!IsPostBack)
BindGrid();
}
public void BindGrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from product",cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
} --------------------编程问答-------------------- 语法错了
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection cn;
protected void Page_Load(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings["CMSConnectionString"];
cn = new SqlConnection(strconn);
if (!IsPostBack)
BindGrid();
}
public void BindGrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from product",cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
} --------------------编程问答-------------------- using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection cn;
protected void Page_Load(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings["CMSConnectionString"];
cn = new SqlConnection(strconn);
if (!IsPostBack)
BindGrid();
}
public void BindGrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from product",cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
} --------------------编程问答-------------------- 楼主打错字了,
建议在输入时使用 命名空间+"."+类名 方式
如System.Data.SqlClient.Sqlconnection ...
这样就不会出现输错类名的情况了,因为IDE有提示功能,并不会让输入效率降低多少(不过要是能输对了也无所谓了) --------------------编程问答-------------------- 楼主不认真啊,没有使用 智能提示 。全自己敲啊 ,还是蛮牛的! --------------------编程问答--------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection cn;
protected void Page_Load(object sender, EventArgs e)
{
string strconn = ConfigurationManager.AppSettings["CMSConnectionString"];
cn = new SqlConnection(strconn);
if (!IsPostBack)
BindGrid();
}
public void BindGrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from product",cn);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
}
--------------------编程问答-------------------- 不会用记事本打的吧..
嘎嘎!! --------------------编程问答-------------------- 顶楼主一下 --------------------编程问答-------------------- 回帖是一种美德!传说每天回帖即可获得 10 分可用分 --------------------编程问答-------------------- 手工录入的,基本功是这样练成的。 --------------------编程问答-------------------- 哎 手工错误 为啥不用提示呢 --------------------编程问答-------------------- 出错一次,下次就记得了 --------------------编程问答-------------------- SqlConnection --------------------编程问答-------------------- up --------------------编程问答-------------------- SqlConnetion 写错了. --------------------编程问答-------------------- SqlConnetion->SqlConnection 少个c --------------------编程问答-------------------- 解决了吧,jf --------------------编程问答-------------------- 楼主真粗心啊 --------------------编程问答-------------------- SqlConnetion —纠正拼写—》SqlConnection --------------------编程问答-------------------- 是Connection 不是Connetion... --------------------编程问答-------------------- 有时就是要出些这些错误才能长记性,哈哈 --------------------编程问答-------------------- 在.net里那个单词的颜色也不一样啊,怎么犯这样的低级错误啊
补充:.NET技术 , ASP.NET