string sql="select * from a where column like "+textbox.text+"%";

解决方案 »

  1.   

    是要做成像MSDN索引那样的吗?
    给TestBox加一个Change事件,然后,在这个事件里面进行数据查询,可以生成一个DataSet这样的话,可以用这个DataSet做为临时表,到时再将这个表写进B表里面不知道有没有说错啊?
      

  2.   

    string str;
    DataSet ds=null;
    SqlCommand cmd=null;
    SqlConnection cn=null;
    SqlDataAdapter da=null;switch(str)
    {
       case 1;
          str=select * from A where 数字列="1*";
       case 0:
          str=select * from A where 数字列="10*";
       cmd.CommandText=str;
    }private void button_Click(object sender, System.EventArgs e)
    {
       TextBox1=Ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][col1].ToString();
       TextBox2=Ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][col2].ToString();
       TextBox3=Ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][col3];
       cmd.CommandText="insert into temp value(textBox1,textBox2,textBox3)";
    }
    private void button1_Click(object sender, System.EventArgs e)
    {
       for(int i=0;i<ds.Tables[0].Rows;i++)
       {
    TextBox1=Ds.Tables[0].Rows[i][col1].ToString();
    TextBox2=Ds.Tables[0].Rows[i][col2].ToString();
    TextBox3=Ds.Tables[0].Rows[i][col3];
    cmd.CommandText="insert into B value(textBox1,textBox2,textBox3)";
       }
    }