473,396 Members | 1,805 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,396 software developers and data experts.

SQL query with datareader or dataadapter

147 100+
Hello

One of my colleagues has done this in vbscript. His code within the recordset is

Expand|Select|Wrap|Line Numbers
  1. "SELECT DISTINCT (ProductNumber), NoOfContacts, Height, Style, Type FROM view WHERE ProfileHeight between 3.0 and 3.9"
How can he be calling the column ProfileHeight when it is not declared?

I am trying to do this in C#, and I can't - if it goes to the dataapater it fails because it wants the column ProfileHeight to be declared.

Any ideas?
Oct 27 '10 #1
5 1900
Oralloy
988 Expert 512MB
Dave,

Try asking the first questions first - does his code actually work?

Assume it does. Then the next question is if you and he are looking at the same "view".

If not, sort that out.

If, however, the view is the same, then I'm as confused as you are.

Luck!
Oct 27 '10 #2
DaveRook
147 100+
Hello

His code works perectly.

The view and my view are pretty much the same (different data) but the actual set up is identical.
Oct 27 '10 #3
Oralloy
988 Expert 512MB
Dave,

It sounds like his view has a ProfileHeight field, where yours doesn't.

Is there any way you can do something like "SELECT * FROM view" on his system and see what fields are actually there?
Oct 27 '10 #4
DaveRook
147 100+
Hi

Had another look.

It appears when you build a recordset or dataadapter, the where clause ignores what columns appear in your select command and looks at the columns available on the actual view on SQL.

I've managed to replicate this now with my C# code and it is fine.

Thank you
Oct 27 '10 #5
Oralloy
988 Expert 512MB
Good on you, and good luck with your assignment.
Oct 27 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: nabil m | last post by:
hi , i have been looking around on msdn and google but i still have a couple of oquestions about the difference between a datareader and a dataset - which to use when - 1) do i have to choose...
5
by: Jason Huang | last post by:
Hi, Is it possible to bind DataReader to a DataGrid in C# windows form? And how? And can we update data in a DataSet by using the DataReader? Thanks for help. Jason
20
by: Mark | last post by:
Hi all, quick question , a DataView is memory resident "view" of data in a data table therefore once populated you can close the connection to the database. Garbage collection can then be used to...
5
by: JIM.H. | last post by:
Hello, I have a SqlDataAdapter component in my design. Is there a way to send a parameter to the query of SqlDataAdapter, I need go get adapter use a where clause and extract data. Is it possible?...
2
by: David Beaven | last post by:
I am creating an aspx page to show (i.e. read only) hundreds or probably thousands of items from two database queries. The user may of course only want to read one or two pages worth. I have (I...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
5
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table...
6
by: Kalim Julia | last post by:
Is it possible to open more than 1 datareader / dataadapter on one connection ? Is it possible to duplicate / clone connection ?
7
by: Varangian | last post by:
Hi all, the question I want to ask if the conversion of a DataReader to a Table looping through the DataReader is better than using the Fill Method of the DataAdapter... I'm asking because...
7
by: Diffident | last post by:
Hello All, I would like to use DataReader based accessing in my Data Access Layer (DAL). What is considered to be a best practice while returning from a DAL method that executes a query and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.