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 &"'

Recommended Answers

All 3 Replies

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.

Hank

what db did you stored?

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()
Access_Connector
Call ViewData
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.