473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 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 5241
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
7
by: astro | last post by:
Anyone have suggestions on where to troubleshoot this error? Background: -Access 2k v. 9.0.6926 sp3 - front and backend on production server (wiindows 2k) -accessed via Citrix -front-end is...
2
by: Brent Burkart | last post by:
Below is the error I am receiving. I have checked SQL Profiler and it is receiving the correct query which runs fine in Query Analyzer. Any ideas? Server Error in '/lockinsheet' Application....
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
39
by: eruanion | last post by:
Hi, I've been working on this for a while now and I can't seem to find out what is wrong with my code. I have 2 files one c3common.js which only contains javascript functions for my main html page...
3
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: ...
2
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application....
1
by: pnbaocuong | last post by:
Dear All When I try to use convert function of MS sql server like this: String sql = " (employee_id = '" + employee_id + "') and ((convert(VARCHAR,w_date,103) = '" + w_date + "'))"; ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.