I'm creating an aspx page that summarizes the number of entries in a database based upon unique column values.
I have two queries being executed. The first selects all records from a MS Access database table. The second selects DISTINCT records from the same MS Access table.
The code works fine for both queries when querying a SQL Server database using the "System.Data.SqlClient" Namespace, bit when using ODBC or OLEDB I get the following error when "fill"ing my DataSet with the data selected using a SQL DISTINCT query.....
"System.Data.Odbc.OdbcException: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1"
Code looks like this:
Dim Connect As New OdbcConnection
Dim QueryString2 as String
Dim Adapter As OdbcDataAdapter = New OdbcDataAdapter
Dim dwppDS As DataSet = New DataSet
Connect.ConnectionString = "DSN=DWPP_database"
QueryString2 = "SELECT DISTINCT System_prefix FROM SOURCETABLE"
Dim dwppCmd2 As OdbcCommand = New OdbcCommand (QueryString2, Connect)
Adapter.SelectCommand = dwppCmd2
Adapter.SelectCommand.Connection.Open
---> Adapter.Fill(dwppDS, "DISTINCT_SOURCE") <----error here
Adapter.SelectCommand.Connection.Close
Any help would be much appreciated....
Thanks,
M. Knapp
When I want to edit/update a row in a datagrid, is there a way to place the mouse focus on that text...
By donetbeginner
Hi all!I've got a quite big problem!We get connected to a SYBASE DataBase, and we usually use stored...
By lonifasiko
I have a MS Access database where the Datatables are stored in a file named *_be.mdb (astrisk in pla...
By war40k
This is more SQL Server than ADO, but this seemed the closest discussion group to what I need.The sp...
By petedavis
Is there an easy way to call the insert method of a objectdatasource. I see the insert method, and ...
By switter65, 4 Comments
Using Visual Studio 2005. I am attempting to use the following (as an example, see actual code in li...
By smokinjoe, 5 Comments
Hi,I'm trying to build a sql insert statement by reading through each textbox the footer of a DataGr...
By capella07, 8 Comments
Hi,When I use "Select DISTINCT * FROM USERS Where UserName Like '*70*' " directly as a query in acss...
By dan333, 1 Comments
Hi all,I am sourcing powerful datagrid components (for web page and windows form) that contains at l...
By bryan123, 3 Comments
In your case, it looks like the "System_prefix" column is not a column from your SOURCETABLE table. Check your database schema. Your code is fine otherwise.
Doug Rothaus
douglasr...microsoft.com
This posting is provided AS IS, with no warranty.
dougr | Mon, 31 Dec 2007 16:25:00 GMT |
Thanks Doug. That's exactly what the problem was.
-M. Knapp
mknapp | Mon, 31 Dec 2007 16:26:00 GMT |