C# :: T-SQL Multi Table Union To Call Out Data

Jul 15, 2014

I'm trying to union eleven tables to call out data. Parent table is 'Events', child tables are 'SR1Laptimes', 'SR2Laptimes' and so on (there are ten SR... tables). Primary key in all tables is EventName. Parent/Child relationship is Events.EventName/SR1Laptimes.EventName etc All tables that start with SR have the same Schema. I'm trying to call out MIN(Q1) across all table but first need to Union them I believe. Here is my code.

myCommand.CommandText = "SELECT MIN(Q1), MIN(Q2), MIN(Q3), MIN(Q4), MIN(LaptimesMinutes), MIN(LaptimesSeconds) FROM (SELECT * FROM Events UNION ALL SELECT * FROM SR1Laptimes UNION ALL SELECT * FROM SR2Laptimes) WHERE (Events.Track = @track) AND (Events.Number = @number) AND (Events.Rider = @rider)";
myCommand.Parameters.AddWithValue("@track", analysisTrackComboBox.Text);
myCommand.Parameters.AddWithValue("@number", analysisNumberComboBox.Text);
myCommand.Parameters.AddWithValue("@rider", analysisRiderComboBox.Text);

View 4 Replies


ADVERTISEMENT

C Sharp :: Copy Data Table To MySQL Table

Mar 25, 2013

I have a C# .NET Application which get data from QuickBooks via the ODBC Driver and save the result to C# data table. So, I want to transfer this data table to a mysql table on my own server. That's the code I use:
 
using System.IO;
using MySql.Data.MySqlClient;
//Add mysql dll on the .NET Tab in Project's references  
string connStr = "DSN=QBTest;";  
            string myServerAddress = "192.168.0.243";
            string myDataBase = "CostTest";

[Code] ....

View 2 Replies View Related

C++ :: Multi Data Types In A Line And Read To Struct?

Aug 14, 2014

How can I read this file in to my struct?

12345Joe Lim KH879.00
12233Kay Suet Yee35.98
23781Leong Jing Yang 10.00
67543Woon Tian Yi500.50
struct master {
unsigned short int IDnum;

[code]....

not working

View 16 Replies View Related

C++ :: Why Windows Multi-threading Data Fetch IOPS Too Fast

Feb 10, 2012

I have a SSD and I am trying to use it to simulate my program I/O performance, however, IOPS calculated from my program is much much faster than IOMeter.

My SSD is PLEXTOR PX-128M3S, by IOMeter, its max 512B random read IOPS is around 94k (queue depth is 32). However my program (32 windows threads) can reach around 500k 512B IOPS, around 5 times of IOMeter!!! I did data validation but didn't find any error in data fetching. It's because my data fetching in order?

I paste my code belwo (it mainly fetch 512B from file and release it; I did use 4bytes (an int) to validate program logic and didn't find problem).

#include <stdio.h>
#include <Windows.h>
/*
** Purpose: Verify file random read IOPS in comparison with IOMeter
**/

//Global variables
long completeIOs = 0;
long completeBytes = 0;
int threadCount = 32;
unsigned long long length = 1073741824; //4G test file

[Code] ....

View 1 Replies View Related

C++ :: Goto Statement - No Output Data Table

Feb 26, 2015

Project Golfer.cpp

So when you enter the number 99 its supposed to quit the program and it wasnt so i fixed that then i noticed that if you don't hit the green its supposed to loop back to a certain point but it was going to far back so i put a goto statement in and now it wont output my data table.

View 1 Replies View Related

C :: Compact Table Representation - Data Structure

Jul 19, 2013

Data structure problem. I have a table of the following format:

Code:
C/R 1 2 3 4 5 6 7 ...
1 x x x
2 x
3 x
4 x
5 x x x
6
... s

So my column and row names are integer numbers if an outcome of some game for a certain column and row lable is a match then we have an x on that position. The size of the integer names for both column and row name is quite large (let us imagine that it is so large that you would need a machine with 500GB of RAM memory to hold this type of table even if x's are treated as regular char's) . In every row there is at least one x and for every column the same holds for the columns. However, the number of x's for a row or a column can be bigger then 1. How to store this table efficiently? (using as less memory as possible).

The data structure should be efficiently accessed in the column fashion that is, if i want to get all values for column 4 I should be able to do that in O(N) time where N= the number of rows.

View 10 Replies View Related

C++ :: Call Function To Output Data?

Dec 10, 2014

I am having an issue with my Call Function to output data. The compiler doesn't like the Call function to output data.

#pragma once
namespace WindowsFormsApplication1 {
using namespace System;

[Code].....

View 1 Replies View Related

C++ :: Make A Table Class That Will Be Able To Have Multiple Columns Of Data?

Sep 17, 2014

I am trying to make a table class that will be able to have multiple columns of data. I want it to have something to hold data (I was using a 2D vector for only one data type) in it, somewhat like a pair, but for any number of data types. The class is a template to make it generalized.

I have looked a little at variadic templates, but I don't know how to declare the vectors for each data types then.

View 4 Replies View Related

C++ :: Dynamically Allocating Hash Table Using Data From File

Nov 5, 2013

I have an abstract based class and three derived classes. I also have a templated hash table class(using chaining as my collision resolution method, an array of stl lists), and a class to parse commands from a file, this also holds the instantiation of the hash table. My question is that since my command parsing class's constructor instantiates the hash table in the main driver(unable to modify) how can I make this dynamically allocated using data from the file?

template<class T>
class hashTable{
public:
hashTable(int size);
~hashTable();

[Code] .....

View 3 Replies View Related

C# :: Save And Upload Data Table From A Text File

Jul 12, 2014

I am having a lot of trouble trying to save and upload a data table from a text file ,the data table which is bound to a datagrid, creates its own columns at the formloading event, and everytime a user clicks a button row is added to the data table. With the loading i put this code which i thought would read a text file and put all the content my datatable however a exception pops up saying Duplicate Name exeption. Heres the loading piece of code :

{
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\DG1.txt ";
if(File.Exists(filePath))
{
StreamReader reader = new StreamReader(filePath);
string line = reader.ReadLine();

[Code] ....

View 11 Replies View Related

C Sharp :: How To Validate Data If Already Exist In Table Record

Sep 24, 2014

How to validate the data if the data already exist in the table record in c#?

For example I wanted to add the student roll no. if roll no. is 134 and if we are adding rollno. 134 student then we get the warning like roll no. 134 is already exist ....

View 1 Replies View Related

C++ :: Multidimensional Arrays - Enter Data Into Table And Display On Screen In Tabular Form

Sep 8, 2014

Write a program to enter data into a table and display on the screen in tabular form. I want to know where are the errors.

#include<iostream>
using namespace std;
int main() {
int table[3][4];
int r,c,i;
r=c=0;
while(r<=2)

[Code] .....

View 3 Replies View Related

C Sharp :: Server Sending Data Then Client Receive And Store In Database Table In Windows Service

Dec 22, 2014

When server send data then client receive that data, in C# windows services where data receive continuously (Using IP Address and port number) . This below code writing in console application . i want implement same logic in windows service side. but i want data receive continuously.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

[Code]....

Above code write in console application, same logic implementing in windows service, but i want data receiving continuously

View 3 Replies View Related

C++ :: Hash Table Program - Sorting Pointer Table After All Of Values Entered

Nov 19, 2013

I am having an issue with my sort function. This is one part of the Hash table program. The main issue is that I am trying to sort the pointer table after all of the values have been entered. The ptr_sort function is not a class function and so I am therefore unable to use the class variables psize and pTable. Is there another way I should be trying this? it is a Vector should I use the sort() function from the vector class in STL?

#include "/home/onyuksel/courses/340/progs/13f/p9/util9.h"
#include "/home/onyuksel/courses/340/progs/13f/p9/hTable.h"

#ifndef H_TABLE1
#define H_TABLE1
void ptr_sort ( );

[Code] ....

View 1 Replies View Related

C++ :: Truth Table Generator - If User Enters String Of Boolean Algebra It Will Output Table

Jan 25, 2013

If a user enters a string of boolean algebra it will ouput the table.

I have input parsing, cycling through the combinations, and outputing working. However once i parse the input I am not sure what to do with it. I have thought of having it write the parsed input to a new file as a function and then use that function, but that seems bad.

How to dynamically create the function, how to implement it.

BTW This is a console function, if that changes anything.

View 2 Replies View Related

C# :: Lookup Non-existent Rows In MySQL Table And Then Update Another Table

Dec 15, 2014

I have written an SQL statement that would:

1) Count the number of rows in the table booking that are open and where the booking.postcode is "MK",

2) Take a note of the plot (in booking.plot_id), and then update the table plot.jobs with the value count.

For example running the SQL query when booking table has the following rows:

Would see the following highlighted values in plot.jobs being updated to 1:

I managed to resolve it with this code so far (note I am using Connector/Net):

public void RefreshPlot(){
string query =
"SELECT Count(*) AS count, plot_id FROM booking WHERE postcode='MK' AND status='open' GROUP BY plot_id";
var cmd = new MySqlCommand(query, _connection);
var da = new MySqlDataAdapter(cmd);
var dtCounts = new DataTable();
da.Fill(dtCounts);

[code]....

Currently, my code only checks for existing rows in the booking table and updates the plot table. However if the row gets deleted in the booking, then the changes are not reflected in the plot table.

Example: If we delete the row with plot.id=1 and plot.plot_id=4, then booking.plot_id should go back to being 0, if it was initially 1. At the moment, it doesn't. How would I update my SQL statement to better reflect this? In a sense, it should check for "non-existent" rows, i.e. the impact that the row plot.plot_id=4 & plot.id=1 has on booking.plot_id when deleted?

View 6 Replies View Related

C :: Using Structure In Union

May 27, 2013

I'm trying to use a structure in union in the following format:

Code:
union data
{
unsigned char All[10] ;
struct data_pkt
{
unsigned char ack;
unsigned short status;
unsigned short data_length;
unsigned char Data[5];
}format;
}adb; adb.

All has 10 bytes which is equivalent to the structure bytes. ie 6 bytes if unsigned char and 2 short i.e 4 bytes. Thus total 10 bytes is given to adb.All. When I print the struct size I get 12 bytes. This creates problem in obtaining data in union. According to the program:

adb.format.ack should have the address of adb.All[0]
adb.format.status should have the address of adb.All[1]
adb.format.data_length should have the address of adb.All[3]
adb.format.Data[0] should have the address of adb.All[5]

But in actual case this is how memory is allocated:

adb.format.ack assigned to the address of adb.All[0]
adb.format.status assigned to the address of adb.All[2]
adb.format.data_length assigned to the address of adb.All[4]
adb.format.Data[0] assigned to the address of adb.All[6]

Why this is happening? How can I solve this?

View 9 Replies View Related

C# :: Use Table Adapter With Textboxes To Edit SQL Table?

Mar 8, 2015

I am a bit stumped with trying to write some code to get the tableadapter/binding source to "update" a current 'user' to the table.

I have the insert/delete methods working fine, but it's the updating that has got me screwed up.

Example of insert.

try
{
personTableAdapter.Insert(tFirstName.Text, tSurname.Text, Convert.ToDateTime(tDoB.Text), tPhone.Text, tAdd1.Text, tAdd2.Text, tSuburb.Text, tState.Text, tPostcode.Text, TeacherType.Text);
teacherTableAdapter.Insert(Convert.ToInt32(tTID1.Text), tRegNo.Text, tPassword.Text);

[Code]....

I also tried to do the updated string/original string with the tableadapter.update, but that didn't work either.

View 7 Replies View Related

C++ :: Using Union For Combining Registers

Nov 16, 2013

How I could use unions to combine registers elegantly. For example I have the 8 bit registers B and C & I have opcodes that work on each independent register such as add b, c, which is simple, but then I also have opcodes that work on both of them as if they're one like ld a, bc. I know I could go about that by just masking them together but I've seen it done with unions before & it made everything so much more simple.

View 4 Replies View Related

C++ :: Using Pointer In Union And Assigning Value

Jul 2, 2013

In the current code,We are using pointer of union and assigning value.

class sample {
union {
short *two_int;
int *four_int;
double *eight_real;
char *one_ascii;
// void *v;
}; }

Than we assign value in following way.

sample.four_int[0] = (x + xoff); ( x and xoff and y and yoff all are integer)
sample.four_int[1] = (y + yoff);

Than we write data into file. it was working fine into 32 bit machine but it is not working 64bit machine. When I compare data and found that data is divided by 4. For Ex The File generating from 32 bit machine contain 80 than 64 bit . File contain 20.

View 7 Replies View Related

C++ :: Changes In Union Typedef Not Mirrored

Sep 1, 2013

I have made VGA emulation with registers and memory in my emulator. But for some reason the writes to the union array with CPU data (register 0-8 of the VGA's Graphics Controller Registers, referenced with <GRAPHREGS>.DATA[index]) don't reflect on the union's data.

typedef union __attribute__((packed)) {
byte DATA[9]; //9 registers present!
struct //Contains the registers itself! {
//Set/Reset Register (index 00h)
union {

[code]...

what's going wrong? Have I made an error in the registers?

(In this case I write to register <GRAPHREGS>.DATA[8] (which should be the <GRAPHREGS>.REGISTERS.BITMASKREGISTER)), but the BITMASKREGISTER stays 0, while DATA[8] gets the correct value.

View 4 Replies View Related

C++ :: Assigning Values To Union?

Sep 10, 2012

I have the following C++ code

typedef union UUID {
unsigned char byte[16]; /**< Array of 16 bytes. */
unsigned int ll[2]; /**< Array of two 64-bit words. */
} UUID;

[Code] ......

The compiler complains thus

$ g++ union.cpp
union.cpp: In function "int main()":
union.cpp:15:17: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
union.cpp:15:17: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
union.cpp:15:17: error: no match for "operator=" in "entry.EntryHeader::uuid = {0, 0, 0, 2}"
union.cpp:1:20: note: candidate is: UUID& UUID:perator=(const UUID&)

How do I go about assigning values to this union in C++.

View 3 Replies View Related

C++ :: Classes Defined With Struct And Union

Mar 12, 2013

Classes defined with struct and union

Classes can be defined not only with keyword class, but also with keywords struct and union.

The concepts of class and data structure are so similar that both keywords (struct and class) can be used in C++ to declare classes (i.e. structs can also have function members in C++, not only data members). The only difference between both is that members of classes declared with the keyword struct have public access by default, while members of classes declared with the keyword class have private access. For all other purposes both keywords are equivalent.

The concept of unions is different from that of classes declared with struct and class, since unions only store one data member at a time, but nevertheless they are also classes and can thus also hold function members. The default access in union classes is public.

The above is a statement taken from a C++ tutorial. So I understand classes a bit better now but the above quote doesnt make too much sense. Is it saying that you can have a class within a class?

View 1 Replies View Related

C :: Under-allocating Memory For A Tagged Union

Mar 6, 2015

What i'm interested in is the behavour of a struct/union constructed like this:

Code:
typedef struct {
uint64_t num1;
uint64_t num2;
} st_a;

typedef struct {
uint64_t num1;
uint32_t num2;

[Code] .....

What kind of behavour could I expect from object, in the following cases:

1. newsomestruct(0)->u.a.num1 = 2;
2. newsomestruct(1)->u.b.num1 = 2;
3. newsomestruct(0)->u.a.num2 = 2;
4. newsomestruct(1)->u.b.num2 = 2;
5. newsomestruct(0)->u.b.num1 = 2;
6. newsomestruct(1)->u.a.num1 = 2;
7. newsomestruct(0)->u.b.num2 = 2;
8. newsomestruct(1)->u.a.num2 = 2;
9. Code:

somestruct* ss1 = newsomestruct(0);
somestruct* ss2 = newsomestruct(1);
* ss1 = * ss2; 10. Code: somestruct* ss1 = newsomestruct(0);
somestruct* ss2 = newsomestruct(1);
* ss2 = * ss1;

This is what I'd expect, but I can't find any evidence online in C standards or elsewhere:

1. Works as expected, sets the value of a.num1 to 2.
2. Works as expected, sets the value of b.num1 to 2.
3. Works as expected, sets the value of a.num2 to 2.
4. Works as expected, sets the value of b.num2 to 2.
5. Works as expected, sets the value of b.num1 to 2.
6. Works as expected, sets the value of a.num1 to 2.
7. Works as expected, sets the value of b.num1 to 2.
8. Crashes/Memory Corruption, attempted to alter memory outside struct.
9. Works as expected, * ss1 == * ss2
10. Crashes/Memory Corruption, attempted to alter memory outside struct.

I've tested simular code on my machine (Xubuntu 14.04LTS compiled with gcc on -O3) and it appears to be reliable, given that you stick with acessing the type tagged in the struct or the common initial union struct members (in this case num1).

View 6 Replies View Related

C++ :: Pointer Of Union And Fwrite Operation

Jul 5, 2013

I have union of pointer.

union {
short *two_int;
int *four_int;
double *eight_real;
char *one_ascii;
// void *v;
};

We have write function which write into file.

fwrite (r.one_ascii, 1, i, outstr);

I found one thing,When we write function, we fill only four int in following way.

r.four_int[0] = x + xoff;
r.four_int[1] = y + yoff;

So my question,we fill four_int but write one_ascii only.As is it union of pointer. So it does not matter. I am using 64bit machine and do not have any issue in 32 bit machine.

For more information: [URL] ....

View 7 Replies View Related

C++ :: How To Find Out Which Member Of Union Is Currently Set / Active

Jan 16, 2015

how to find out which member of union is currently set/active.

exm:
union myunion{
int i;
float f;
}

if i set myunion ob{7}, it set ob.i=7;

my q? is how to find out i is set f is not set/ not acrive

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved