本帖最后由 ming5941 于 2010-07-23 19:36:54 编辑

解决方案 »

  1.   

    ado.net操作,数据库操作类sqlhelper
    using(SqlConnectionconn conn= new SqlConnection(strCon))
     { 
      conn.Open();
      SqlCommand cmd= new SqlCommand ("",conn);
      cmd.ExecuteNonQuery();
    }
    查询数据绑定到gridview等select * fropm article 
      

  2.   

    显示select * fropm article  
    修改 update article   set filed='filedValue' where ..
    删除delete article where ..
      

  3.   

    都是写个方法然后传语句或者变量过去的,汗。。
    你会Insert,那么Update和Delete无非的差别就是SQL语句不一样了
    至于Select显示数据,你得用一个数据容器来存放数据,然后再绑定到控件或者遍历循环输出。
    常用的有
    using System.Data;  下的DataSet,DataTable等
    using System.Data.SqlClient; 下的DataReader(保持连接并读取一行,并且是只读向前的,读完须关闭对象)帮你找到了一个例子
    http://blog.csdn.net/renyouprince/archive/2008/11/20/3339368.aspx
      

  4.   

     string strSQL = "insert into article (title,author,content,addtime) values('" + strTitle + "','";
      strSQL += strAuthor;
      strSQL += "','";
      strSQL += strContent;
      strSQL += "',getdate())";
      SqlCommand objCm = objCn.CreateCommand();
      objCm.CommandText = strSQL; //明确一下连接对象  
      // objCm.Connection= objCn; 
      objCm.ExecuteNonQuery();  //3.关闭数据库连接
      objCn.Close();
      

  5.   

    只需要把你代码中的
    //2.执行SQL语句
    中的string strSQL改成相应的sql语句即可。
    只举一例:
    string strSQL="update users set password='123456' where id='lz'"//更新用户密码