新手程序出现一些问题,求解

幽灵Killer 幽灵Killer 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我想做一个查询, 界面是,我根据书本上打,代码是
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void btnLogin_Click1(object sender, EventArgs e)
{


string ConnStr = ConfigurationManager.ConnectionStrings["ConnString"].ToString(); //调用连接字符串
SqlConnection con = new SqlConnection(ConnStr);
SqlCommand cmd=new SqlCommand ("selectname",con );
cmd .CommandType=CommandType .StoredProcedure ;
cmd .Parameters .Add (new SqlParameter ("@uame",SqlDbType .NChar ,6));
cmd.Parameters["@uame"].Value = txtUserName.Text;
con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();


}
}
}
这时候出现一个错误。错误时,为什么提示存在。我是根据书上打的啊
...全文
评论 9
收藏 已收藏
分享
返回顶部
幽灵Killer
C# 111,129 成员 642,540 内容