SQL query returns data, .NET returns #42S22Unknown column binding to dataset

I have a webservice with a common function which calls MYSQL and returns a dataset. Today I encounterd a strange error when performing a Select with a count() in it which I cant figure out. From a command line, the SQL query works fine and returns 9 rows... but VB.NET bombs with an error when filling the data adapter with the returned data. Please see my sample code below, is there an additional flag I need to call to make this work with VB?

SQL Command Line: ( Works Great )

mysql> Select taction, count(*) from kiosklogs where packageid='NewHi-Def-Test' group by taction;
| taction  | count(*) |
| AAAA.Org |        3 |
| ARF      |        4 |
| Box      |       10 |
| Car      |        5 |
| Frog     |       20 |
| Soda     |        7 |
| Star     |        7 |
| TSB7     |        2 |
| TSB8     |        3 |
9 rows in set (0.00 sec)
SQL = "Select taction, count(*) from kiosklogs where packageid='NewHi-Def-Test' group by taction"
oMySqlConn = New MySqlConnection
oMySqlConn.ConnectionString = DBConn.ConnectionString
Dim cmd As New MySqlCommand(SQL, oMySqlConn)
Dim myAdapter As New MySqlDataAdapter
Dim selectData As New DataSet
myAdapter.SelectCommand = cmd
myAdapter.Fill(selectData)    <----- Errors here!


Failed#42S22Unknown column 'taction' in 'field list'"

The above code works fine with a standard SELECT or INSERT, etc... but it seems to be related to the Count(*) rather than the column taction wich definately exists.

1/24/2008 11:44:38 PM
asp.net.mysql 1929 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 19
Get it on Google Play
Get it on Apple App Store

Try using count(*) as cnt.  This has helped me in the past.  I think the cast gives the object an index within the reader.


Please click on 'Mark as Answer' if this post answered your question!
1/24/2008 11:58:26 PM

Thank you for the prompt response. I added the cast for good measure but the problem persists. Since this webservice call is not currently used, I deployed it to production to make sure its wasnt bypassing my hosts file or some other discrepency.... and low and behold it works as expected. All of my WebService calls from within Visual Studio's dev encironment work returning validated production data except this one call.. but since it works when deployed, I guess I cant complain.

Chalk it up to VS strangeness. :)

1/25/2008 12:39:45 AM

I solve my own problems all the time as well.


Please click on 'Mark as Answer' if this post answered your question!
1/25/2008 1:04:23 AM

Similar Artilces:

Y ADO.NET does not return a simple ReadOnly Query data as a DataTable though we need most of the times a Single Table of Data from DataBase ? Similar to DataAdapter returning a DataSet ! Or can we Typ
Hi All, After we moved from JSP and started developing a web application in ASP.NET, the DataAdapter is used for all sort of operations like insert/update/delete for a table. But, most of the time we need to query the data from db for a Table/View and the returned data will be a Single Table of data. Though ADO.NET has a facility of keeping such a data in DataTable, y does ADO.NET have not provided a way to return a DataTable. Similar to DataAdapter returning a DataSet. Its like a mix up of DataReader and DataAdapter with Read Only component returning DataTable. Or, please let me know...

ns1.entrust.net and ns2.entrust.net returning SERVFAIL for AAAA query
This is a multi-part message in MIME format. --------------000409010802080300070100 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Which causes both Firefox and Thunderbird to indicate certificate validation failure when configured to treat OCSP problems as validation failures. Email to entrust.net DNS zone contact bounces. Telephone contacts not fruitful. Similar problem afflicts crl.entrust.net. Is this a topic suitable for this newsgroup, or one of the other Mozilla newsgroups? (Apologies if not). Regards, Gary gapinski@chipotle:~> ...

Carriage returns with returned SQL data
In PB10 is it possible to create a single computed field the takes values returned by an SQL query and apply a carriage return function to put each returned value onto its own line. I have to program a datawindow that prints an address, but the address has to be formatted differently depending on whether a) there is an address line 2, at which point the city, state, zip all move up 1 line or b)if the address has to meet a different layout for international users (eg Germany where the zip comes before the city). Sure. I'd separate the address elements into different columns, use S...

SQL query returns 'No column name' as a column heading
 hi,I'm trying to execute this query in SQL Server 2005 Express Edition, the problem is in the column heading of the result for the majorName fieldSELECT studentID,fname,mname,lname,familyName,gpa ,(SELECT majorName AS major FROM major WHERE majorID=(SELECT majorID FROM studentmajorWHERE studentID='0000000'))FROM student WHERE studentID='0000000'; Why the result of this query returns 'No column name' as a label for the majorName field? I use the AS clause to allows the column to be named, the column heading of the result table still 'No column name&...

Data returned from .WriteXML is different than what is returned in query analyzer.
I have a strange problem. I have some code that executes a sql query. If I run the query in SQL server query analyzer, I get a set of data returned for me as expected. This is the query listed on lines 3 and 4. I just manually type it into query analyzer. Yet when I run the same query in my code, the result set is slightly different because it is missing some data. I am confused as to what is going on here. Basically to examine the sql result set returned, I write it out to an XML file. (See line 16). Why the data returned is different, I have no idea. Also writing it out to an XML file is...

COM .NET Interop
Hi, I need help here.. I have this problem.I have COM VB6 that call a .NET class library, and this class library use the .NET SAP Conector to extract the information from SAP. I receive the information from SAP in a DataTable, the problem here is that I dont how to return this DataTable to VB6 COM. I made a test, and I can return a String to COM and basic types, but I dont know how to do it with this DataTable.Thanks for your helpI really appreciate. One alternative might be to add the DataTable to a DataSet and then convert the DataSet to an XML string using WriteXml(). That said, quic...

Combine sql query from multiple returns to 1 return
the following is my query, what I would like to do is show 1 line for every person instead of  potentiall many.  Most of the information is redundent except for the dates and the count of the dates and mileage.  What I would like to do is combine all the dates into one field and do a count on them for 1 tally as well as the mileage.  Here is how the information come out currently per the query.133RD       F31LFVXG      GASPERSZ       555555555      E3-6  ...

Return Dataset to Non-.NET Applications
Hello all, I have been intrigued by the concept of service oriented architecture and thought it would be a good idea to get a concrete example under my belt.  So, I took one of my data layer objects and wanted to return a DataSet.  It works fine for .NET applications, but I have come to find out that the dataset is not an interoperable object.  So, how does return this type of data to another platform?  If I'm providing the schema in the response, is it then the responsibility of the consumer to transform the data into something they can use?  Or does that go agains...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Is returning DataSets better than returning Custom Objects from a Data Access Layer?
Is returning DataSets better than returning Custom Objects from a Data Access Layer? What are the advantages of each?www.LinkToIslam.net Designing Data Tier Components and Passing Data Through TiersRegards,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks! I can createa Data Access Layer which returns custom object and DataSets.  I would simply like to know whether it's better to return datSe...

Table view of data returned from mySQL query
I am a fairly new user of C++ Builder with XE2 and could use some help finding the right component to view in a table the data returned from a mySQL query using dbExpress TSQLQuery. If anyone can point me to the right component and some code examples, I would greatly appreciate it. ...

VB .NET Dataset SQL query results
Hi, I'm hoping someone can shed some light on how I can address variables returned to a dataset via a stored procedure.I've coded an AJAX Autocomplete control but due to the restriction of the control (only being able to return one value) I now need to use the returned value to search my DB.  The stored procedure used for the Autocomplete returns the key information (and the description).  I'm assuming the key info is stored within the dataset. So my question is, how do I read the key information into a variable for use elsewhere?Stored proc Select Statement; SELECT SU...

How to read XML data returned from a sql query
Hello All,  I am struggling with is for a while now. Here’s what I am trying: I have SQL SELECT query which returns the data in the XML format. My query is: SELECT XMLELEMENT("SAMPLE", XMLAGG(XMLELEMENT("PRODUCTID", PR.PRODUCT_ID))) AS "PRODUCTNUMBERS"FROM PRODUCTS_TABLE PRWHERE PR.PRODUCT_NAME LIKE “R%”; When I run the query it works fine and returns this output:<SAMPLE>  <PRODUCTID>56</PRODUCTID>  <PRODUCTID>55</PRODUCTID>  <PRODUCTID>54</PRODUCTID>  <PRODUCT...

How do I return the Count from my scalar query vb.net
When I type in cntrows.  I get all my table variables except the one I want which is TotalComments.      How do I return the Count from my scalar query?  I have a Table Adapter named :   tblUserInfo A scalar query named Using the table adapter wizard : GetCommentCount   The SQL for it is:  SELECT     COUNT(*) AS TotalComments FROM         tblUserInfo  Which when I execute it returns TotalComments   Here is my VB Code Protected Sub form1_Load(ByVal sender A...

Web resources about - SQL query returns data, .NET returns #42S22Unknown column binding to dataset - asp.net.mysql

Resources last updated: 11/24/2015 9:54:13 PM