Daily scrum 11.5

生活的轨迹如若不是一层不变,也大体不会偏离多少。“休假”两天,大家又回到了“休假”前的状态,不过整体势头越来越好,今天的task的统计:

 

燃尽图:

 

王莹同学的写的一个链接数据库的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace TeamWork
{
class Connection
{
protected SqlConnection connection;
protected string conString;
public Connection(string serverIp,string dbName,string user,string password)
{
this.conString = string.Format("data Source='{0}';initial Catalog='{1}';User ID='{2}';password='{3}'",serverIp,dbName,user,password);
connection=new SqlConnection(conString);
connection.Open();
}
public static SqlConnection instance(string serverIp="localhost",string dbName="BigHouse",string user="sa",string password="10061177")
{
Connection con = null;
try
{
if (con == null)
{
con = new Connection(serverIp,dbName,user,password);
}
}
catch(SqlException e)
{
Console.WriteLine(e.StackTrace);
System.Console.WriteLine("Error connecting the SQL server.");
return null;
}
return con.connection;
}

}
}

孙胜同学编写的查询界面代码:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace WebApplication7
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)//获取一个值
{
DropDownList1.DataSource = GetSuplier();//从该对象中检索数据项列表
DropDownList1 .DataTextField ="SuplierID";//获取列表项提供文本内容的数据源字段
// DropDownList1 .DataBind ();//将数据源绑定到被调用的服务器控件
}
}

private SqlDataReader GetSuplier()
{
string connectionStr = "Data Source=TIHBH0LDYN4I38C;Initial Catalog=WebSelected;Integrated Security=True";
SqlConnection con=new SqlConnection (connectionStr);
con.Open ();
SqlCommand cmd=new SqlCommand ("select distinct 网站性质 from dbo.Web ",con);
return cmd.ExecuteReader (CommandBehavior.CloseConnection );
con.Dispose();
}

private void GetSpecialProduct(string SuplierID)
{
int count = 0;
string connectionStr = "Data Source=TIHBH0LDYN4I38C;Initial Catalog=WebSelected;Integrated Security=True";
SqlConnection con = new SqlConnection(connectionStr);
con.Open();
SqlCommand cmd = new SqlCommand("select * from dbo.Web where 网站性质=@SuplierID ", con);
cmd.Parameters.AddWithValue("@SuplierID", SuplierID);//使用AddWithValue方法添加参数
SqlDataReader pdr = cmd.ExecuteReader();
using (pdr)
{
if (pdr.HasRows)
{
GridView1.DataSource = pdr;
GridView1.DataBind();
}
}
cmd.CommandText = "select count(*)from dbo.Web where 网站性质=@SuplierID1";
cmd.Parameters.AddWithValue("@SuplierID1",SuplierID );
JbInto .Text = "共有" + cmd.ExecuteScalar () + "记录";
}

protected void Button1_Click(object sender, EventArgs e)
{
GetSpecialProduct(DropDownList1.SelectedValue);
}

}
}

posted on 2012-11-05 23:19  fightingsnail1  阅读(215)  评论(0编辑  收藏  举报

导航