当前位置:编程学习 > C#/ASP.NET >>

请帮忙解答问号的地方应该怎么写,请教!

private void shanchu_Click(object sender, EventArgs e)
          {
          

           DialogResult dr = MessageBox.Show("确定删除吗?","Led",MessageBoxButtons.OKCancel);
              SqlConnection conn=new SqlConnection();
              //conn.Open();
              if (dr == DialogResult.OK)
              {
                  if (conn.State == ConnectionState.Closed)
                  {
                      conn.Open();
                  }

                 ?? = dbconn("delete from UserInformation where Userid='dr'");
              }
          }
写了一个有关删除的位置把SQL的声明但是函数的转换还不是很清楚.有高人请解答并讲解一下~ --------------------编程问答-------------------- 刚问题已解决~但出现connecting String 属性尚未初始化?不明白 --------------------编程问答--------------------
?? = dbconn("delete from UserInformation where Userid='dr'");

估计返回 int ,表示删除的行数!

int deletedCount = dbconn("delete from UserInformation where Userid='dr'");

但是,dbconn 的行为并不清楚,最好把鼠标放在上面看一下返回值的类型! --------------------编程问答-------------------- SqlConnection conn=new SqlConnection();
改为
SqlConnection conn=new SqlConnection("你的连接串"); --------------------编程问答-------------------- SqlConnection conn=new SqlConnection("server=.uid=sa;pwd=;datebase=master"); --------------------编程问答-------------------- ConnectionString   没赋值 
http://topic.csdn.net/t/20060528/18/4784487.html --------------------编程问答-------------------- 刚问题已解决~但出现connecting String 属性尚未初始化?不明白
============================================================
SqlConnection conn=new SqlConnection("server=(local);database=;uid=;pwd="); --------------------编程问答-------------------- SqlConnection conn=new SqlConnection("server=.;uid=sa;pwd=你的密码;datebase=你的数据库名"); --------------------编程问答-------------------- SqlConnection conn=new SqlConnection();
--------------------------------------------
连接到那里去啊?? --------------------编程问答-------------------- SqlConnection conn=new SqlConnection();
缺少 链接 参数.
类似
SqlConnection conn=new SqlConnection("server=(local);uid=sa;pwd=123456;database=test;");
--------------------编程问答-------------------- SqlConnection conn=new SqlConnection("server=(local);uid=sa;pwd=123456;database=test;"); --------------------编程问答-------------------- SqlConnection conn = new SqlConnection();
           conn = new SqlConnection("server=(local);database=LED;uid=sa;pwd=");
           conn.Open();       
           SqlDataAdapter adp = new SqlDataAdapter();
           DataSet mydt=new DataSet();
           //mydt.Tables = dtselect.rows();
              conn.Open();
                if (dr == DialogResult.OK)
                {                   
                     DataTable da= dbconn("delete from UserInformation where UserId='dr'");
                     
                }
                  adp.Update(mydt, "UserInformation");
                  conn.Close();   
              }
              catch(Exception err)
              {
                MessageBox.Show(err.Message+ToString());
              }
          
请教~conn已经关闭为什么我做的CATCH语句块还会提示说未关闭? --------------------编程问答-------------------- dbconn是个什么东西?执行怎样的一个功能?
--------------------编程问答-------------------- 你在别的地方有声明么? dbconn系统里是没有这个方法的

你在最后一行加上dbconn.close()看看吧。。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,