我是新手,请多多帮助!

解决方案 »

  1.   

    这是C#,自己换成vb.net的    SqlConnection conn =null;
    SqlDataAdapter dapt = null;
    DataSet ds = new DataSet();
    string strConnectionString = "Data Source=.;initial catalog=数据库;uid=sa;pwd=xxx";
    string strSQL  = "SELECT 字段 from 表"
    try
    {
    conn =  new SqlConnection(strConnectionString);
    conn.Open();
    dapt = new SqlDataAdapter(strSQL,conn);
    dapt.Fill(ds,"table1");
    DataTable dt = ds.Tabls[0];
    if(dt.Rows.Count >0)
    {
      this.Text1.Text = dt.Rows[0]["字段"].ToString();
    }

    }
    catch(System.Exception e)
    {
     this.Text1.Text = "错误"+e.Message;
    }
    finally
    {
    if(conn!=null)
    conn.Dispose();
    if(dapt!=null)
    dapt.Dispose();
    }
      

  2.   

    select id from admin where username='"+username+"'
      

  3.   

    string selectsql="select * from admin where username='"+this.username+"'";SqlDataAdapter ad=new SqlDataAdapter(selectsql,con);DataSet ds=new DataSet();ad.Fill(ds,"admin");this.Lable1.Text=ds.Table[0].Row[0].["user_id"].tostring;this.DataBinder();我也是新手   你试看看
      

  4.   

    这个是用username变量来赋值
    如果想赋值给一个变量,那么你首先得取数据,取到数据了才能存在赋值