472,143 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

error: Data source is an invalid type

Dan
Hi,

I'm learning asp.net 2.0 and i get this error:
"Data source is an invalid type. It must be either an IListSource,
IEnumerable, or IDataSource"

My code:
Dim a As GridView
Dim oConnection As OleDbConnection
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim sql As String
Dim a as GridView
Dim sConnectionString As String
sConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c\test.mdb"
oConnection.ConnectionString = sConnectionString
oConnection.Open()
sql = "SELECT ...;"

comd = New OleDbCommand(sql, oConnection)
a = New GridView
a.DataSource = comd
a.DataBind()
oConnection.Close()

Thanks
Dan

May 23 '06 #1
3 5102
On Tue, 23 May 2006 12:37:05 +0200, "Dan" <xx*@ddd.fv> wrote:
Hi,

I'm learning asp.net 2.0 and i get this error:
"Data source is an invalid type. It must be either an IListSource,
IEnumerable, or IDataSource"

My code:
Dim a As GridView
Dim oConnection As OleDbConnection
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim sql As String
Dim a as GridView
Dim sConnectionString As String
sConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c\test.mdb"
oConnection.ConnectionString = sConnectionString
oConnection.Open()
sql = "SELECT ...;"

comd = New OleDbCommand(sql, oConnection)
a = New GridView
a.DataSource = comd
a.DataBind()
oConnection.Close()

Thanks
Dan


I think you are wanting to make your datasource a dataset, not a
OleDbCommand. You need to create a dataset, the fill it using a
dataadapter.
Peter Kellner
http://peterkellner.net
May 23 '06 #2
Dan
Thanks,
I make a new post because of another error

"PeterKellner" <pk**********@73rdstreet.com> wrote in message
news:8a********************************@4ax.com...
On Tue, 23 May 2006 12:37:05 +0200, "Dan" <xx*@ddd.fv> wrote:
Hi,

I'm learning asp.net 2.0 and i get this error:
"Data source is an invalid type. It must be either an IListSource,
IEnumerable, or IDataSource"

My code:
Dim a As GridView
Dim oConnection As OleDbConnection
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
Dim sql As String
Dim a as GridView
Dim sConnectionString As String
sConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source= c\test.mdb"
oConnection.ConnectionString = sConnectionString
oConnection.Open()
sql = "SELECT ...;"

comd = New OleDbCommand(sql, oConnection)
a = New GridView
a.DataSource = comd
a.DataBind()
oConnection.Close()

Thanks
Dan


I think you are wanting to make your datasource a dataset, not a
OleDbCommand. You need to create a dataset, the fill it using a
dataadapter.
Peter Kellner
http://peterkellner.net

May 23 '06 #3
On Tue, 23 May 2006 17:18:55 +0200, "Dan" <xx*@ddd.fv> wrote:
Thanks,
I make a new post because of another error

"PeterKellner" <pk**********@73rdstreet.com> wrote in message
news:8a********************************@4ax.com.. .
On Tue, 23 May 2006 12:37:05 +0200, "Dan" <xx*@ddd.fv> wrote


Sounds like you got it working. Glad to hear. I was hoping you
wouldn't ask me for an example in VB.
Peter Kellner
http://peterkellner.net
May 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

39 posts views Thread by eruanion | last post: by
2 posts views Thread by Nathan Sokalski | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.