Data gathering

Killgore

New member
Joined
Apr 9, 2008
Messages
3
Programming Experience
1-3
Hi, I'm working on a little project here and I need to get some info from One form and use it on a second form. Example frmAssetSearch is just a textbox and a button and the information that is in the second box needs to be used on the form frmAssetInfo in a query that will gather all the information. Here is the code for frmAssetInfo

VB.NET:
    Private Sub frmAssetInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim conn As OleDbConnection
        Dim cmd As OleDbCommand
        Dim dr As OleDbDataReader
        Dim Asset As String

        Asset = frmAssetSearch.txtAssetNo.Text

        Try
            conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0 Data Source=N:\IT Equipment Asset Management.mdb;")

            'provider to be used when working with access database
            conn.Open()
            cmd = New OleDbCommand("select * from Asset Database WHERE N/RY Decal = 'Asset' ", conn)
            dr = cmd.ExecuteReader
            While dr.Read()
                TextBox1.Text = dr(0)
                TextBox2.Text = dr(1)
                TextBox3.Text = dr(2)
                ' loading data into TextBoxes by column index
            End While
            dr.Close()
            conn.Close()
        Catch
        End Try



    End Sub

I tought that the 'Asset' variable was declared properly and I dont know exactly how to use the 'Asset' variable in the query also.
 

Latest posts

Back
Top