473,587 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UNION in SQL for DataAdapter gives me error when configuring

Here is my SQL:

SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.Facili tyID = tblFacility.Fac ilityID)
UNION ALL
SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.Facili tyID = tblFacility.Fac ilityID)

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 1478
da************@ gmail.com wrote:
Here is my SQL:

SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.Facili tyID = tblFacility.Fac ilityID)
UNION ALL
SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.Facili tyID = tblFacility.Fac ilityID)

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.Op en();

SqlCommand MyCommand = new
SqlCommand("SEL ECT * FROM CaseInfo",
MyConnection);
SqlDataReader MyDataReader =
MyCommand.Execu teReader(Comman dBehavior.Close Connection);

while (MyDataReader.R ead())
{
Console.WriteLi ne(MyDataReader[0] + " " +
MyDataReader[1]);
}

MyConnection.Cl ose();


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.goo glegroups.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.Arraylis t

Public Function Getthedata() as System.Arraylis t

dim strsql = " all of your Select stuff"

dim temparray as new System.Arraylis t

SQL Command stuff in the Example

while (MyDataReader.R ead())

dim info = new infodata

info.field = DataReader("rec id") // 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(i nfo)

end while

MyConnection.Cl ose();

return temparray

end fucntion

end class

dim getd = new Getdata()

datagrid.dataso urce = getd.Getthedata

datagrid,databi nd

It's something like that.

Jun 5 '07 #4
Darien,

This is typical a question for the newsgroup

microsoft.publi c.dotnet.framew ork.adonet

Cor

<da************ @gmail.comschre ef in bericht
news:11******** *************@d 30g2000prg.goog legroups.com...
Here is my SQL:

SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssue INNER JOIN
tblFacility ON tblIssue.Facili tyID = tblFacility.Fac ilityID)
UNION ALL
SELECT tblIssue.IssueN umber, tblFacility.Fac ilityName,
tblIssue.IssueB rief, tblIssue.IssueS tatus FROM (tblIssueRO INNER JOIN
tblFacilityRO ON tblIssue.Facili tyID = tblFacility.Fac ilityID)

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
7811
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 Files\IBM\SQLLIB\bin\db2.exe CREATE TOOLS CATALOG SYSTOOLS USE EXISITING DATABASE DWCTRLDB FORCE" to initialize and\or migrate the DB2 tools catalog...
6
3027
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 Solaris 8.1, with 64-bit instances. I have a NICKNAME called REMOTE_DW.T_MYTABLE which points to a "union-all-view". Several other nicknames exist...
4
2933
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
1965
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 follows: portb = 0x0f; But when I want to define a register as follows, the code does not
6
377
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 successfully.... what can i do?
2
3547
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
3247
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
2160
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 the xml and validates correctly. When I try to use one of the enumeration in the drop down list, the xml will not validate. When I validate the xml...
3
7706
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
7915
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.