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

UNION in SQL for DataAdapter gives me error when configuring

Here is my SQL:

SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.FacilityID = tblFacility.FacilityID)
UNION ALL
SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.FacilityID = tblFacility.FacilityID)

tblFacility and tblFacilityRO are identical
tblIssue and tblIssueRO are identical

Any ideas why my sql doesn't work? It comes up saying there were
errors configuring the adapter.

Darien

Jun 5 '07 #1
4 1471
da************@gmail.com wrote:
Here is my SQL:

SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.FacilityID = tblFacility.FacilityID)
UNION ALL
SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.FacilityID = tblFacility.FacilityID)

tblFacility and tblFacilityRO are identical
tblIssue and tblIssueRO are identical

Any ideas why my sql doesn't work? It comes up saying there were
errors configuring the adapter.

Darien
If it works in SQL Query Analyzer, then it's solid. Maybe, the
DataAdapter just can't deal with it.

Maybe, you can try Dynamic SQL code using SQL Command Object and a
DataReader.

The example is a C# example, but of course, you can do the same thing in VB.
MyDataReader[1] // equals field two of the fields being pulled back in
the recordset record.

Or you can use MyDataReader['caseid'] // if field 0 is the record's key.

You might have to go through a Convert to set a database field to the
proper variable type.
SqlConnection MyConnection = new SqlConnection(@"Data Source=(local);
Initial Catalog = CaseManager; Integrated Security=true");

MyConnection.Open();

SqlCommand MyCommand = new
SqlCommand("SELECT * FROM CaseInfo",
MyConnection);
SqlDataReader MyDataReader =
MyCommand.ExecuteReader(CommandBehavior.CloseConne ction);

while (MyDataReader.Read())
{
Console.WriteLine(MyDataReader[0] + " " +
MyDataReader[1]);
}

MyConnection.Close();


Jun 5 '07 #2
I have gotten a query like that to work directly on the database, it
seems the UNION just kills it for the data adapter.

Essentially what I'm trying to accomplish is this. I have two
identical tables in my database. One is a list of issues that have
been recorded, the other is a list of issues that have not been
recorded. (I have them seperate because I am syncing the unrecorded
table up to a master list, then back down to the recorded list. I
need a datagrid to show the records from both in case your viewing
between syncs.

Darien

Jun 5 '07 #3

<da************@gmail.comwrote in message
news:11**********************@n15g2000prd.googlegr oups.com...
>I have gotten a query like that to work directly on the database, it
seems the UNION just kills it for the data adapter.
If it works on the database then, the its going to work with a SQL Command
Object with a ADO.DataReader.
>
Essentially what I'm trying to accomplish is this. I have two
identical tables in my database. One is a list of issues that have
been recorded, the other is a list of issues that have not been
recorded. (I have them seperate because I am syncing the unrecorded
table up to a master list, then back down to the recorded list. I
need a datagrid to show the records from both in case your viewing
between syncs.
Yes you can easily do it by making a Function that returns an ArrayList of
Objects, binding it to the datagrid.

Public class infodata

with Propery Gets and Lets
end class

Public class Getdata() as System.Arraylist

Public Function Getthedata() as System.Arraylist

dim strsql = " all of your Select stuff"

dim temparray as new System.Arraylist

SQL Command stuff in the Example

while (MyDataReader.Read())

dim info = new infodata

info.field = DataReader("recid") // you may need to use the Convert and
you
// may need to
wrap with IF checking for Null before
// populating data
or making field Null or 0
temparray,add(info)

end while

MyConnection.Close();

return temparray

end fucntion

end class

dim getd = new Getdata()

datagrid.datasource = getd.Getthedata

datagrid,databind

It's something like that.

Jun 5 '07 #4
Darien,

This is typical a question for the newsgroup

microsoft.public.dotnet.framework.adonet

Cor

<da************@gmail.comschreef in bericht
news:11*********************@d30g2000prg.googlegro ups.com...
Here is my SQL:

SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.FacilityID = tblFacility.FacilityID)
UNION ALL
SELECT tblIssue.IssueNumber, tblFacility.FacilityName,
tblIssue.IssueBrief, tblIssue.IssueStatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.FacilityID = tblFacility.FacilityID)

tblFacility and tblFacilityRO are identical
tblIssue and tblIssueRO are identical

Any ideas why my sql doesn't work? It comes up saying there were
errors configuring the adapter.

Darien

Jun 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: azgoddess1 | last post by:
During the installation I get these error messages: ***** SQL1390C The environment variable DB2Instance is not defined or is invalid An error ocured while loading the command "C:\Program...
6
by: _link98 | last post by:
Problem: getting SQL0181N for queries on nicknames to remote Union-All-View. Can't see what I'm doing wrong yet, maybe someone has seen this before. Environment: UDB ESE 8.1 + FIXPAK 9A, on...
4
by: Girish | last post by:
I have 2 differesnt defination of same Union as below and a piece of code for printing size of Union and its members.. union U { union U { int i; int j; }a;
11
by: jlara | last post by:
Working on an embedded controller, I generally find it convenient to define the following de-referenced pointer: #define portb (*(unsigned char *)(0x03u)) This enable me to write to a port as...
6
by: Norton | last post by:
When i try to use OleDbDataAdapter's QueryBuilder, when i type some SQL Statement "Select Top X .....", it works and display the correct result, however i cannot generate the select statement...
2
by: propoflady | last post by:
When I do the following union query - it works but it gives me blank records then my list SELECT , FROM BuyerListName UNION SELECT , FROM Buyers ORDER BY ;
30
by: Yevgen Muntyan | last post by:
Hey, Why is it legal to do union U {unsigned char u; int a;}; union U u; u.a = 1; u.u; I tried to find it in the standard, but I only found that
1
by: stran | last post by:
I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in...
3
by: SRK | last post by:
Hi, I wanted to use an anonymous union within an structure something like below - struct Test { union { std::string user; //char user; std::string role; //char role;
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.