!如题,网上我找过了,都不是很好用(我要的是开发源码,带项目启动的那种),请高手分享啊,如果好用请在http://community.csdn.net/Expert/topic/4263/4263649.xml?temp=.9170954登陆下,一起给分!!!绝对立刻揭帖~!

解决方案 »

  1.   

    ALTER PROCEDURE Question_add
    /*
    添加问题
    */
    @Question varchar(50),
    @A int,
    @B int,
    @C int,
    @D int,
    @AA varchar(50),
    @BB varchar(50),
    @CC varchar(50),
    @DD varchar(50),
    @YesOrNo int
    AS
    INSERT INTO Question
          (AA, BB, CC, DD, Question, A, B, C, D, YesOrNo)
    VALUES (@AA, @BB, @CC, @DD, @Question, @A, @B, @C, @D, @YesOrNo)
    RETURN 
    ===================================
    ALTER PROCEDURE Question_del
    /*
    删除问题
    */
    @ID int
    AS
    DELETE FROM Question
    WHERE (ID = @ID)
    RETURN 
    =================================
    ALTER PROCEDURE Question_mod
    /*
    修改问题
    */
    @Question varchar(50),
    @A int,
    @B int,
    @C int,
    @D int,
    @AA varchar(50),
    @BB varchar(50),
    @CC varchar(50),
    @DD varchar(50),
    @ID int
    AS
    UPDATE Question
    SET A = @A, B = @B, C = @C, D = @D, AA = @AA, BB = @BB, CC = @CC, DD = @DD, 
          Question = @Question
    WHERE (ID = @Question)
    RETURN 
    ================================================
    ALTER PROCEDURE Question_sel
    /*
    遍历调查表
    */
    AS
    SELECT Question.*
    FROM Question
    RETURN 
    ============================
    ALTER PROCEDURE Question_selWhereYesOrNo
    /*
    遍历调查表
    */
    @YesOrNo int
    AS
    SELECT Question.*
    FROM Question
    WHERE (YesOrNo = @YesOrNo)
    RETURN 
    ==========================
    ALTER PROCEDURE Question_updQuestionWhereID
    /*
    更新问题字段
    */
    @Question varchar(50),
    @ID int
    AS
    UPDATE Question
    SET Question = @Question
    WHERE (ID = @ID)
    RETURN 
    ================================
    ALTER PROCEDURE Question_updWhereQuestion
    /*
    更新问题数据
    */
    @A int,
    @B int,
    @C int,
    @D int,
    @AA varchar(50),
    @BB varchar(50),
    @CC varchar(50),
    @DD varchar(50),
    @Question varchar(50)
    AS
    UPDATE Question
    SET A = @A, B = @B, C = @C, D = @D, AA = @AA, BB = @BB, CC = @CC, DD = @DD
    WHERE (Question = @Question)
    RETURN 
    ======================
    ALTER PROCEDURE Question_updYesOrNo_0
    /*
    把所有的问题隐藏
    */
    @YesOrNo int
    AS
    UPDATE Question
    SET YesOrNo = @YesOrNo
    RETURN 
    ===========================
    ALTER PROCEDURE Question_updYesOrNoWhereQuestion
    /*
    更新显示问题
    */
    @Question varchar(50),
    @YesOrNo int
    AS
    UPDATE Question
    SET YesOrNo = @YesOrNo
    WHERE (Question = @Question)
    RETURN 
      

  2.   

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Collections;namespace Db
    {
    /// <summary>
    /// Question 的摘要说明。
    /// </summary>
    public class Question
    {
    public Question()
    {
    //
    // TODO: 在此处添加构造函数逻辑
    //
    } private SqlConnection conn;
    private SqlCommand cmd;
    private SqlDataReader dr; public void addQuestion(ArrayList a)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_add",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Question",SqlDbType.VarChar,50).Value = a[0];
    cmd.Parameters.Add("@A",SqlDbType.Int).Value = a[1];
    cmd.Parameters.Add("@B",SqlDbType.Int).Value = a[2];
    cmd.Parameters.Add("@C",SqlDbType.Int).Value = a[3];
    cmd.Parameters.Add("@D",SqlDbType.Int).Value = a[4];
    cmd.Parameters.Add("@AA",SqlDbType.VarChar,50).Value = a[5];
    cmd.Parameters.Add("@BB",SqlDbType.VarChar,50).Value = a[6];
    cmd.Parameters.Add("@CC",SqlDbType.VarChar,50).Value = a[7];
    cmd.Parameters.Add("@DD",SqlDbType.VarChar,50).Value = a[8];
    cmd.Parameters.Add("@YesOrNo",SqlDbType.Int).Value = a[9]; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    } public SqlDataReader drQuestionWhereYesOrNo(int i)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_selWhereYesOrNo",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@YesOrNo",SqlDbType.Int).Value = i; conn.Open();
    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
    return dr;
    } public SqlDataReader drQuestion()
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_sel",conn);
    cmd.CommandType = CommandType.StoredProcedure; conn.Open();
    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
    return dr;
    } public void updWhereQuestion(ArrayList a)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_updWhereQuestion",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@A",SqlDbType.Int).Value = a[0];
    cmd.Parameters.Add("@B",SqlDbType.Int).Value = a[1];
    cmd.Parameters.Add("@C",SqlDbType.Int).Value = a[2];
    cmd.Parameters.Add("@D",SqlDbType.Int).Value = a[3];
    cmd.Parameters.Add("@AA",SqlDbType.VarChar,50).Value = a[4];
    cmd.Parameters.Add("@BB",SqlDbType.VarChar,50).Value = a[5];
    cmd.Parameters.Add("@CC",SqlDbType.VarChar,50).Value = a[6];
    cmd.Parameters.Add("@DD",SqlDbType.VarChar,50).Value = a[7];
    cmd.Parameters.Add("@Question",SqlDbType.VarChar,200).Value = a[8]; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    } public void updQuestionWhereYesOrNo(string a,int i)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_updYesOrNoWhereQuestion",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Question",SqlDbType.VarChar,50).Value = a.ToString();
    cmd.Parameters.Add("@YesOrNo",SqlDbType.Int).Value = i; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    } public void updYesOrNo_0(int i)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_updYesOrNo_0",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@YesOrNo",SqlDbType.Int).Value = i; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    } public void updQuestionWhereID(string a,int i)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_updQuestionWhereID",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Question",SqlDbType.VarChar,50).Value = a.ToString();
    cmd.Parameters.Add("@ID",SqlDbType.Int).Value = i; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    } public void delQuestion(int i)
    {
    conn = new SqlConnection(Str.con);
    cmd = new SqlCommand("Question_del",conn);
    cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID",SqlDbType.Int).Value = i; conn.Open();
    try
    {
    cmd.ExecuteNonQuery();
    }
    catch(Exception ex)
    {
    throw new Exception(ex.Message);
    }
    finally
    {
    cmd.Dispose();
    conn.Close();
    }
    }
    }
    }
      

  3.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace WebApplicationDlh21
    {
    /// <summary>
    /// 添加调查问题。
    /// </summary>
    public class Admin_AddQuestion : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.TextBox txtQuestion;
    protected System.Web.UI.WebControls.TextBox txtAA;
    protected System.Web.UI.WebControls.TextBox txtBB;
    protected System.Web.UI.WebControls.TextBox txtCC;
    protected System.Web.UI.WebControls.TextBox txtDD;
    protected System.Web.UI.WebControls.TextBox txtA;
    protected System.Web.UI.WebControls.TextBox txtB;
    protected System.Web.UI.WebControls.TextBox txtC;
    protected System.Web.UI.WebControls.TextBox txtD;
    protected System.Web.UI.WebControls.Button btnAdd;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void btnAdd_Click(object sender, System.EventArgs e)
    {
    if(txtQuestion.Text == "" || txtA.Text == "" || txtB.Text == "" || txtC.Text == "" || txtD.Text == "")
    {
    Response.Write("<script>alert('不允许为空!')</script>");
    }
    else
    {
    Db.Question myQuestion = new Db.Question();
    ArrayList a = new ArrayList();
    a.Add(txtQuestion.Text.Trim());
    a.Add(int.Parse(txtA.Text));
    a.Add(int.Parse(txtB.Text));
    a.Add(int.Parse(txtC.Text));
    a.Add(int.Parse(txtD.Text));
    a.Add(txtAA.Text.Trim());
    a.Add(txtBB.Text.Trim());
    a.Add(txtCC.Text.Trim());
    a.Add(txtDD.Text.Trim());
    a.Add(0); myQuestion.addQuestion(a);
    Response.Write("<script>alert('添加成功!')</script>");
    txtQuestion.Text = "";
    txtAA.Text = "";
    txtBB.Text = "";
    txtCC.Text = "";
    txtDD.Text = "";
    }
    }
    }
    }
      

  4.   

    各位老师:
         能否帮我写一个VC#.net和SQL连接的数据库报表源代码程序,谢谢!
      

  5.   

    我想要的是项目的开发源代码啊,
    MicroSoftASPNET(我不是思归) 老大,能不能发个给我啊?我的QQ:28180791
     MSN:[email protected]
      

  6.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace WebApplicationDlh21
    {
    /// <summary>
    /// 管理调查投票
    /// </summary>
    public class Admin_ModQuestion : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.DataGrid dgQuestion;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面 if(!IsPostBack)
    {
    dgQuestionBind();
    }
    } private void dgQuestionBind()
    {
    Db.Question myQuestion = new Db.Question();
    dgQuestion.DataSource = myQuestion.drQuestion();
    dgQuestion.DataBind();
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.dgQuestion.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgQuestion_CancelCommand);
    this.dgQuestion.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgQuestion_EditCommand);
    this.dgQuestion.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgQuestion_UpdateCommand);
    this.dgQuestion.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgQuestion_DeleteCommand);
    this.dgQuestion.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgQuestion_ItemDataBound);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void dgQuestion_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    dgQuestion.EditItemIndex = e.Item.ItemIndex;
    dgQuestionBind();
    } private void dgQuestion_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemIndex<0) return;
    e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='eeeeee'"); 
    e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor"); for(int i=0;i<this.dgQuestion.Items.Count;i++)
    {
    this.dgQuestion.Items[i].Cells[3].Attributes.Add("onclick","return confirm('确定删除该记录?')");
    }
    } private void dgQuestion_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    Db.Question myQuestion = new Db.Question();
    myQuestion.updQuestionWhereID(((TextBox)dgQuestion.Items[dgQuestion.EditItemIndex].Cells[1].FindControl("TextBox1")).Text.ToString(),Convert.ToInt32(dgQuestion.DataKeys[e.Item.ItemIndex]));
    dgQuestion.EditItemIndex = -1;
    dgQuestionBind();
    Response.Write("<script>alert('修改成功!')</script>");
    } private void dgQuestion_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    dgQuestion.EditItemIndex = -1;
    dgQuestionBind();
    } private void dgQuestion_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    Db.Question myQuestion = new Db.Question();
    myQuestion.delQuestion(Convert.ToInt32(dgQuestion.DataKeys[e.Item.ItemIndex]));
    dgQuestionBind();
    }
    }
    }
      

  7.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace WebApplicationDlh21
    {
    /// <summary>
    /// 查看调查票数
    /// </summary>
    public class Admin_QuestionView : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.DataGrid dgQuestion;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if(!IsPostBack)
    {
    dgQuestionBind();
    }
    } private void dgQuestionBind()
    {
    Db.Question myQuestion = new Db.Question();
    dgQuestion.DataSource = myQuestion.drQuestion();
    dgQuestion.DataBind();
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion
    }
    }
      

  8.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace WebApplicationDlh21
    {
    /// <summary>
    /// 在首页显示投票问题的设置
    /// </summary>
    public class Admin_SetQuestion : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Button btnSet;
    protected System.Web.UI.WebControls.RadioButtonList rbQuestion; protected string strQuestion;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if(!IsPostBack)
    {
    rbQuestionBind();
    }
    } private void rbQuestionBind()
    {
    Db.Question myQuestion = new Db.Question();
    rbQuestion.DataSource = myQuestion.drQuestion();
    rbQuestion.DataTextField = "Question";
    rbQuestion.DataValueField = "ID";
    rbQuestion.DataBind(); SqlDataReader dr = myQuestion.drQuestionWhereYesOrNo(1);
    if(dr.Read())
    {
    /*SqlDataReader dr1 = myQuestion.drWhereQuestion(dr.GetString(9));
    if(dr1.Read())
    {
    rbQuestion.SelectedValue = Convert.ToString(dr1.GetInt32(0));
    }*/
    rbQuestion.SelectedValue = Convert.ToString(dr.GetInt32(0));
    }
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.btnSet.Click += new System.EventHandler(this.btnSet_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void btnSet_Click(object sender, System.EventArgs e)
    {
    Db.Question myQuestion = new Db.Question();
    myQuestion.updYesOrNo_0(0);
    myQuestion.updQuestionWhereYesOrNo(rbQuestion.SelectedItem.Text,1);
    Response.Write("<script>alert('设置成功!')</script>");
    }
    }
    }