用SQL语句,查询数据库中一条记录的某一单元中的某一个值,怎样把它
赋到文本框中?

解决方案 »

  1.   

    text1.Text = Rs.Fields("xxx")
      

  2.   

    如果你用ado写的话,那么
    大概是这样的,
    dim strSQL as string
    dim rst as new adodb.recordset 
    strSQL ="select * from Table"
    rst.open strSQL ,cnn,3,1
    if not rst.eof then
        test1.text="" & rst.fields("你的字段名").value 
    else
       test1.text="" 
    end if
      

  3.   

    Rs.Open "select * from Manger where Name='" & txtName & "'", cn, adOpenDynamic, adLockBatchOptimistic
      

  4.   

    dim strSQL as string
    dim rst as adodb.recordset 
    strSQL ="select * from Table"
    set rst=cnn.execute(strsql)
    if not rst.eof then
        test1.text="" & rst.fields("字段名").value '如果是多记录可用循环else
       test1.text="" 
    end if
    set rst=nothing
      

  5.   

    text1="" & rs("FiledName1") '前面的""是将rs的NULL的记录强制转换为string,就不用一堆if判断