data grid @ run time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjeetgrang
    New Member
    • Feb 2008
    • 36

    data grid @ run time

    in my form i have datagrid and adodc. i set adodc 's porperty and data grid well. all data is displaying well in grid. but i now wan selected data in grid (say for a particular date only) i am doing as on click event of command button

    [code=vb]
    Dim cn as new adodb.connectio n
    dim rs as recordset
    cn.open("DSN=no rthwind") ' where northwind is DSN
    set rs =cn.execute("se lect * from tablename where datefield= ' " & date & " ')
    set adodc1.recordse t = rs
    adodc1.refresh
    datagrid1.refre sh
    [/code]

    it gives me blank grid(no data). i have VB6 and MS Access
    what i am doing wrong

    Anysuggestion
    Last edited by debasisdas; Apr 1 '08, 11:11 AM. Reason: added code=vb tags
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by manjeetgrang
    in my form i have datagrid and adodc. i set adodc 's porperty and data grid well. all data is displaying well in grid. but i now wan selected data in grid (say for a particular date only) i am doing as on click event of command button

    [CODE=VB]
    Dim cn as new adodb.connectio n
    dim rs as recordset
    cn.open("DSN=no rthwind") ' where northwind is DSN
    set rs =cn.execute("se lect * from tablename where datefield= ' " & date & " ')
    set adodc1.recordse t = rs
    adodc1.refresh
    datagrid1.refre sh
    [/CODE]

    it gives me blank grid(no data). i have VB6 and MS Access
    what i am doing wrong

    Anysuggestion
    Greetings and salutations!

    Would you mind posting the code that runs okay also?

    Might help to compare the two, and be able to pin point the problem.

    Sorry for your troubles:-)

    Dököll

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Please ensure that data exists in the database table for the particular date and change the name of the variable. Don't use Date as a field / variable name as it is a datatype in database .

      Comment

      • manjeetgrang
        New Member
        • Feb 2008
        • 36

        #4
        i have set the values of adodc nd datagrid at design time and on form load/run grid displays all the record and on click on activeorders command button i have exactly this code as below
        [code=vb]
        Private Sub activeorders_Cl ick()
        Dim cn As New ADODB.Connectio n
        Dim rs As Recordset
        cn.Open ("DSN=northwind ")
        Set rs = cn.Execute("sel ect * from tblreceivedorde rs where pickupdate = cvdate('" & Date & "')")
        ' i need records for today's date in grid
        Set Adodc2.Recordse t = rs
        Adodc2.Refresh
        DataGrid2.Refre sh
        End Sub
        [/code]
        Last edited by debasisdas; Apr 1 '08, 11:13 AM. Reason: added code= vb tags

        Comment

        Working...