473,396 Members | 2,059 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.

VB.NET create/insert/select From Temp table

Hi all,
Google search engine brought me here. I am so desperated and hope you guys could give me some help. This is my first .NET project to connect to AS400 database. I used Microsoft.Data.Odbc, and was able to connect to the database with no problem. Next I want to generate a report where I need to query many different tables and do pivotting on the dataset ... So I decide to save some of the dataset to a temp table, and I was able to do so. However, I couldn't access any of those temp tables. I know they are saved in QTemp database, but I don't know how to connect to them.
Could you guys give me some hints, please? Thanks so much.


Here is my code. The create table part works, but I can't insert or select
-------------------------------------------------------------------------------------------------------
oCon = New OdbcConnection("Dsn=PRODUCTION")
oCmd = New OdbcCommand()
oCmd.Connection = oCon
oCmd.CommandText = "Declare Global Temporary Table MyTest (" & _
"IEITM NUMERIC(8,0), " & _
"IELEDG CHARACTER(2)) on commit preserve rows"
oCon.Open()
oCmd.ExecuteNonQuery()
Nov 15 '07 #1
1 6730
docdiesel
297 Expert 100+
Hi,

if I understand you right, you connect to the db a first time, create the temp. table, write some date to it and subsequently disconnect. Then another script connects to the very same db, and it's not able to read from the temp. table.

Have a look at http://publib.boulder.ibm.com/infoce...n/r0003272.htm for documentation about the DECLARE GLOBAL TEMPORARY TABLE statement. The temp. tables are not persistent and will be dropped after disconnecting. So you'll have to run your SQL statements right after filling the table and before disconnecting, or use a real table to store your results. I hope this information did help? Or did I guess wrong?

Regards,

Bernd
Nov 16 '07 #2

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

Similar topics

6
by: dev | last post by:
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? please any help? if i have 10 fields in 1 record and...
7
by: Galina | last post by:
Hello I am going to copy a data from MS Access table into Oracle table. One of fields is memo type and data in this field range from 1 character to 551 long string. Do I need to create a field...
6
by: Lauren Quantrell | last post by:
I have a table tblCustomers in a one-to-many relationship with table tblProducts. What I want to do is to create a stored procudure that returns a list of each customer in tblCustomers but also...
1
by: Lauren Quantrell | last post by:
I have a temp table that's populated with an insert query in as tored procedure. The temp table has a uniqueID as the primary key. In that table I have a column SortOrder. What I want to do is to...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
3
by: rhaazy | last post by:
Using ms sql 2000 I have 2 tables. I have a table which has information regarding a computer scan. Each record in this table has a column called MAC which is the unique ID for each Scan. The...
4
by: M Bourgon | last post by:
I have two SPs, call them Daily and Weekly. Weekly will always call Daily, but Daily can run on its own. I currently use a global temp table because certain things I do with it won't work with a...
2
by: orenlevy1 | last post by:
Hi Everyone. I have a problem that I could not figure out what to do with it. I have a couple of tables and views. All have the same unique ID. When a user try to do a search on our web site...
0
by: ramuygl | last post by:
want to create store procedure that. want to send the table name as argument and retrive the data of that argument. and want to store data in temperary table using the insert query. HERE I AM...
6
by: lenygold via DBMonster.com | last post by:
Hi everybody: What is the best way to I have 10 tables with similar INSERT requiremnts. INSERT INTO ACSB.VAATAFAE WITH AA(AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP) AS ( SELECT AA_TIN,...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.