作业1: 左边的代码:(请逐行注释) protected void Page_Load(obje
作业1:左边的代码:(请逐行注释)protectedvoidPage_Load(objectsender,EventArgse){SqlConnectionmyconn=...
作业1:
左边的代码:(请逐行注释)
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myconn = new SqlConnection();
myconn.ConnectionString = "server=.;database=bookshop;uid=sa;pwd=";
myconn.Open();
string sql = "select * from book";
SqlCommand mycomm = new SqlCommand(sql,myconn);
SqlDataReader myreader = mycomm.ExecuteReader();
GridView1.DataSource = myreader;
GridView1.DataBind();
}
右边的代码:(请逐行注释)
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myconn = new SqlConnection();
myconn.ConnectionString = "server=.;database=bookshop;uid=sa;pwd=";
myconn.Open();
string sql = "select * from book";
SqlCommand mycomm = new SqlCommand(sql,myconn);
SqlDataAdapter mysda = new SqlDataAdapter(mycomm);
DataSet myds = new DataSet();//老大是System.Data
mysda.Fill(myds, "mydsBook");
GridView1.DataSource = myds.Tables["mydsBook"];
GridView1.DataBind();
} 展开
左边的代码:(请逐行注释)
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myconn = new SqlConnection();
myconn.ConnectionString = "server=.;database=bookshop;uid=sa;pwd=";
myconn.Open();
string sql = "select * from book";
SqlCommand mycomm = new SqlCommand(sql,myconn);
SqlDataReader myreader = mycomm.ExecuteReader();
GridView1.DataSource = myreader;
GridView1.DataBind();
}
右边的代码:(请逐行注释)
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myconn = new SqlConnection();
myconn.ConnectionString = "server=.;database=bookshop;uid=sa;pwd=";
myconn.Open();
string sql = "select * from book";
SqlCommand mycomm = new SqlCommand(sql,myconn);
SqlDataAdapter mysda = new SqlDataAdapter(mycomm);
DataSet myds = new DataSet();//老大是System.Data
mysda.Fill(myds, "mydsBook");
GridView1.DataSource = myds.Tables["mydsBook"];
GridView1.DataBind();
} 展开
展开全部
static void(int[]group)
{
int temp;
int pos=0;
for(int i=0;i< group.Length-1;i++)
{
pos=i;
for(intj=i+1;j<group.Length;j++)
{
if(group[j]<group[pos])
{
pos=j;
}
}//第i个数与最小的数group[pos]交换
temp=group[i];
group[i]=group[pos];
group[pos]=temp;
}
}
{
int temp;
int pos=0;
for(int i=0;i< group.Length-1;i++)
{
pos=i;
for(intj=i+1;j<group.Length;j++)
{
if(group[j]<group[pos])
{
pos=j;
}
}//第i个数与最小的数group[pos]交换
temp=group[i];
group[i]=group[pos];
group[pos]=temp;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询