SqlCommand scd = strconn.CreateCommand();你Command对象这样去创建

解决方案 »

  1.   

    还有,你看下这样是否能取到连接字符串?
    用个变量接收下这个值:System.Configuration.ConfigurationManager.AppSettings["strcon"]
      

  2.   

    System.Configuration.ConfigurationManager.AppSettings["strcon"]
    配置文件没有配置
      

  3.   

    web.config里没有配置strcon
    web.config :
    <add key="strcon" value="server=(local);uid=userid;pwd=pwd;database=database" />
      

  4.   

    没什么问题的样子啊...
    不过你的代码通遍是tostirng,textbox.text本来就是string,再tostring就非常多余了.
      

  5.   

    System.Configuration.ConfigurationManager.AppSettings["strcon"]); 
    取不到值。
      

  6.   

    SqlCommand   scd  使用哪个SqlConnection   你指定了吗?
      

  7.   

    同意6楼,System.Configuration.ConfigurationManager.AppSettings["strcon"]应该没有取到值,Web.config配置有问题!