Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2003, 10:32 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid population

Dear Users,

I continue to show an error on this piece of code. What should I declare Adodc1 as?


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim StrConnect As String
        Dim cn As ADODB.Connection
        Dim rs As ADODB.Recordset


        kStart = txtStart.Text
        kStop = txtEnd.Text

        StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\DATA\ACCESS\13FloorEquipment.mdb"
        cn = New ADODB.Connection()
        cn.Open(StrConnect)
        nItem = CboItems.Text

        Listbox1.Items.Clear()

        strSQL = strSQL & "SELECT * FROM(Requests) "
        strSQL = strSQL & "WHERE (([ItemName]= '" & nItem & "')"
        strSQL = strSQL & "AND (([StartDate])"
        strSQL = strSQL & "BETWEEN #" & kStart & "#"
        strSQL = strSQL & "AND #" & kStop & "#));"

        'rs = cn.Execute(strSQL)
        rs = New ADODB.Recordset()
        MsgBox(kStart)
        MsgBox(kStop)
        MsgBox(strSQL)
        With rs
            .ActiveConnection = cn
            .CursorLocation = ADODB.CursorLocationEnum.adUseServer
            .CursorType = ADODB.CursorTypeEnum.adOpenKeyset
            .LockType = ADODB.LockTypeEnum.adLockOptimistic
            '.Properties("IRowsetIdentity") = True
            .Open(strSQL, cn)

        End With
'******************************************
        ADODB1.Recordset = rs
        DataGrid1.DataSource = ADODC1.Recordset
'************************************************
    End Sub
 
Old November 6th, 2003, 11:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I commented out the line of code :
Set Adodc1.Recordset = rs
and
Changed the following line to :
Set DataGrid1.DataSource = rs

But recieved the following error:

Additional information: Complex DataBinding accepts as a data source either an IList or an IListSource

I am totally lost someone please help





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic collection population from database micmit C# 2005 7 September 19th, 2006 05:53 AM
Runtime Population of a JTable Sandz Java GUI 1 February 28th, 2005 10:10 AM
Re-population of text boxes Louisa VB.NET 2002/2003 Basics 3 March 16th, 2004 05:59 AM
Datagrid Population jayabhatia .NET Web Services 3 November 6th, 2003 11:10 AM
Datagrid Population jayabhatia .NET Web Services 1 October 31st, 2003 11:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.