duxingzhe058858 2015-11-25 11:15 采纳率: 0%
浏览 2086

visual studio与数据库访问

在visual studio中往数据库中的表中添加信息:代码如下
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Server=.;DataBase=HRM_26wsy;integrated security=SSPI";
string strSql;
strSql = "Insert Into UserInfo(UserName,Passerword,Role)Values('" + txtName.Text + "','" +txtPassword.Text+ "'," + Convert.ToInt16(txtRole.Text) + ")";
SqlCommand cmd = new SqlCommand(strSql, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
lblMessage.Text = "已添加成功";

    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        txtName.Text = " ";
        txtPassword.Text = " ";
        txtPassword1.Text = " ";
        txtRole.Text = " ";
        lblMessage.Text = " ";

    }

但在运行时会出现这种错误:编译错误

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误消息: CS1061: “ASP.添加记录_aspx”不包含“TextBox1_TextChanged”的定义,并且找不到可接受类型为“ASP.添加记录_aspx”的第一个参数的扩展方法“TextBox1_TextChanged”(是否缺少 using 指令或程序集引用?

还有我在开头已经打了 using System.Data;
using System.Data.SqlClient;

  • 写回答

2条回答 默认 最新

  • Robot-C 2015-11-25 11:21
    关注

    在Visual Studio下报错fatal error C1083: Cannot open include file: 'cv.h': No such file or directory
     
    不知道你安装OpenCV没有,没有就需要安装,安装后见如下操作:

    在VS的项目设置中添加openCV的头文件路径。还有,设置这些引用等。

    菜单Tools->Option......
    答案就在这里:在Visual Studio下报错fatal error C1083: Cannot open include file: 'cv.h': No such file or directory
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献