Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Query

hello all..

heres a newbie question but plz bare with me.

connection to the database is ok btw.



my problem:
i need to make a query inside VB to exstract information from a SQL database.
can i use a simple textbox for this? i mean just double click the textbox and write the code in there?




Comments

  • Daniel_JohnsDaniel_Johns Member Posts: 18
    : hello all..
    :
    : heres a newbie question but plz bare with me.
    :
    : connection to the database is ok btw.
    :
    :
    :
    : my problem:
    : i need to make a query inside VB to exstract information from a SQL database.
    : can i use a simple textbox for this? i mean just double click the textbox and write the code in there?
    :
    :
    :
    :
    :

    can you re-phrase your question? you mean that can you execute a query that you type-in a textbox? if so, you can. for example, if you're gonna display the record(s) that are the result of your query in a datagrid, with a textbox (text1) and a commandbutton (Command1),

    dim Con as NEW ADODB.Connection
    dim Rs as NEW ADODB.Recordset

    Sub Command1_Click()
    Dim tmpConstr as string
    Dim tmpstr as string

    tmpConstr = "your connection string here"
    tmpstr = Val(Text1.text)

    Con.Open tmpConstr

    Rs.Open tmpstr, Con

    Set DataGrid1.DataSource = Rs

    End Sub

    hope this is what you mean...and hope this help you...


    <<--U gona w8 hir FATBOY -- w8 til 2morow! -->>

Sign In or Register to comment.