.net 如何条件查询


我的意思是显示出ProjectorFM表的数据,然后点击数据就会显示ProjectorCs这个表的数据.
就写了两端,新手无从下手,请说思路和难点.

   
  protected void xs()
  
{
string connectionString = ConfigurationManager.ConnectionStrings["Projector"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
con.Open();
SqlCommand comm = new SqlCommand("select * from ProjectorFM"+"", con);
SqlDataReader read = comm.ExecuteReader();

while (read.Read())
{

Response.Write(read[1].ToString());

}

}
   
  public void sdClick()
  
{
string connectionString = ConfigurationManager.ConnectionStrings["Projector"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);

con.Open();
SqlCommand comm1 = new SqlCommand("select * from ProjectorCs ", con);
SqlDataReader read1 = comm1.ExecuteReader();
while (read1.Read())
{

Response.Write(read1[0].ToString());

Response.Write(read1[1].ToString());

Response.Write(read1[2].ToString());

Response.Write(read1[3].ToString());

Response.Write(read1[4].ToString());

Response.Write(read1[5].ToString());

Response.Write(read1[6].ToString());

Response.Write(read1[7].ToString());

Response.Write(read1[8].ToString());

Response.Write(read1[9].ToString());
Response.Write("<br>");


}

.net c#

回来家结婚 11 years, 6 months ago

Your Answer