hello 2 all,
anyone can help me.i am a newbie on programming and i dont know how to use grid. this is the scenario when i search on a database using sql i want to display it to a grid. i am using the component Microsoft datagrid control 6.0 (SP4)(OLEDB).
this is the sample code pls continue it..tnx
Select * from table1 where Uname = '" & Text1.Text & "' and Pword = '" & Text2.Text &"'

10 Years
Discussion Span
Last Post by Jx_Man

You should add a Microsoft ADODC data control component.

In the properties of that control, you need to set the Connection String, the Command Type, and the Record Source.

After you do this, then you need to set the Data Source Property of the Microsoft Data Grid Control. And that should be it.



if u using access try this following code :

Private Sub ViewData()
    Set rs = New ADODB.Recordset
        rs.CursorType = adOpenDynamic
        rs.LockType = adLockOptimistic
        rs.Open "SELECT * FROM Login Where UserID = '" & txtUserId.Text & "' AND Password = '" & txtPasw.Text & "'", Conn, , , adCmdText
    Set DataGrid1.DataSource = rs
    DataGrid1.Columns(0).Width = 2000
    DataGrid1.Columns(1).Width = 2000
    DataGrid1.AllowAddNew = False
    DataGrid1.AllowArrows = True
    DataGrid1.AllowDelete = False
    DataGrid1.AllowUpdate = False
End Sub
Private Sub btnView_Click()
Call ViewData
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.