C# :: Grabbing Column From More Than One Table

Oct 18, 2014

I am writing a code in which i need to grab a column from a variety of tables. So basically there are 10 tables in which they hey have the same columns inside of them (Submitted and Amount). I need to grab the amount column from all the tables. What would be the c# sql command for that.

View 5 Replies


ADVERTISEMENT

C# :: Avoiding Hardcoding Column And Table Names

Jan 6, 2015

I've just started working on a Database application and maintaining a previous developer's code, one thing I see is that column and table names are hardcoded throughout the code which is something I'd like to avoid. To me it seems like a practice that is prone to spelling mistakes reaping havoc across the application.

Some I've looked at include:

Constant strings
const string TableName_ColumnName = "TestName";
Dictionary and Enum:
public static string GetColumnName(ColumnId inColId)
{

[Code]....

I think I prefer the second option but it means that retrieving the column names means quite a long winded function call.

View 7 Replies View Related

C++ :: Grabbing Words From A Text

Jul 30, 2014

im trying to do is get a huge text file, grab information from it and output into another file, for example the file contains:

userid = xxsfdfafa, name = vinnidrk, product = 12341,
otherfield = 1
otherfield2 = 2
otherfield3 = 4

userid = asdsada, name = anotherperson, product = 424123,
otherfield = 3
otherfield2 = 5
otherfield3 = 1

What i want, is to be able to get the name for every account until end of file and output it one under the other.
vinnidrk
anotherperson

View 4 Replies View Related

C# :: Grabbing All Rows From MySQL Select Statement

Feb 5, 2015

I don't understand when I'm only requesting a specific column on a unique row in MySQL that I'm being returned with data from all columns of that row.

My Select Statement - "select article from post where idpost=" + strIDpost + ";"

I should get:
|--- article -----|
"some article text"

Instead I get:
|-idpost-|-title-|---- article------|
1 title some article text

If I run the command directly to the database I get the results I'm looking for, but somehow while running the application, the program is managing to pull the entire row.

I'm using C# on a webform in Visual Studio '13. Here's my Code:

public static string GetConnectionString() {
string connStr = String.Format("server={0};user id={1}; password={2};" +
"database=dbname; pooling=false", "servername",
"dbUserID", "dbPassword");

[Code] .....

View 7 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 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# :: 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++ :: How To Sum Row And Column Of 2D Arrays

Apr 11, 2013

For example If I have the following . How would I sum each row and column ??

For example

1 2 3 4 5
0 1 3 8 9

View 6 Replies View Related

C++ :: Iterating Over Either Row Or Column?

Jul 3, 2014

Suppose I want to represent an apartment building in terms of floors and rooms with a single data object. Each floor has the same number of rooms at any given time. During the course of the program, I will need to change the number of floors occasionally and will need to change the number of rooms on each floor occasionally. (Don't worry about the building permits needed to do this.) Now, I also want to be able to iterate over either each floor (think "row") or each room (think "column"). For example, I might want to program the equivalent of "Johnson, go fix all the front doors on the 8th floor" or the equivalent of "Johnson, go fix all the front doors to room B on each floor". (Yeah, I know, for the latter I could iterate over each floor and then access room B but that doesn't feel as "clean" as being able to iterate over a separate room/column.)

View 7 Replies View Related

C++ :: Row And Column Index?

Dec 16, 2013

If i have current index and row/columns count how do i get on which row and on which column index is individually?

This is what i have tried, but column index is incorrect:

#include <iostream>
int main()
{
int rows = 5;
int colm = 6;
int inx = 12;
int rowInx = inx % rows;
int colInx = inx % colm;
std::cout << "row: " << rowInx << std::endl;
std::cout << "col: " << colInx << std::endl;
return 0;
}

View 4 Replies View Related

C/C++ :: Iterating Over Either Row Or Column?

Jul 31, 2014

Suppose I want to represent an apartment building in terms of floors and rooms with a single data object. Each floor has the same number of rooms at any given time. During the course of the program, I will need to change the number of floors occasionally and will need to change the number of rooms on each floor occasionally. (Don't worry about the building permits needed to do this.)

Now, I also want to be able to iterate over either each floor (think "row") or each room (think "column"). For example, I might want to program the equivalent of "Johnson, go fix all the front doors on the 8th floor" or the equivalent of "Johnson, go fix all the front doors to room B on each floor". (Yeah, I know, for the latter I could iterate over each floor and then access room B but that doesn't feel as "clean" as being able to iterate over a separate room/column.)

View 2 Replies View Related

C :: Subtracting One Column In 2D Array From Another?

Oct 18, 2013

I have a 2d array where I manage donations and requests for different foods. I output a menu to the user who picks the options to either make a donation, make a request, fulfill a request, or print a status report of all the donations and requests. What I'm having trouble with is the fulfilling requests option. When the user picks fulfill requests that means that the donations are supposed to be subtracted from the requests. For example if there are 10 donations for grains and 15 requests for grains then after picking fulfill request there should be 0 donations for grains and 5 requests for grains but I don't know how to make the program do that since the values are in a 5 row by 2 column array. The five rows correspond to the five foods and the two columns correspond to donations and requests, respectively. Here's my code so far. Just disregard everything but the third case.

Code:
#include <stdio.h>int main(){
int foodbank[5][2]= {
{0,0},
{0,0},

[Code]....

View 6 Replies View Related

C :: Sorting 2D Array By Column

Oct 24, 2013

i have a matrix containing a lot of points and each point has its coordinates x and y. That is a nx2 size array. I want to sort it according to the first column ascending, with x coordinates. For points that have the same x coord i would like to sort according to y coord. Here is what i did and i cannot get a good result.

Code:

#include <stdio.h>
#include <stdlib.h>
int main(){
int a[5][2] = {{1,0}, {4,2}, {2,4}, {8,6},{4,8}};
int temp=0;
int i=0;
int j=0;

[Code]...

View 4 Replies View Related

C++ :: Sort Particular Column Of CSV File

Apr 6, 2013

I need sorting a particular column (column 1) of a .cvs file (the file has 10 columns) by alphabetic order. How I can accomplish this ?

View 1 Replies View Related

C++ :: Salary Column Output Zero

Feb 21, 2014

void calcWeeklyPay(double empData[][COLS], const int count) {
double wage;
double hour;
int row;
for (row = 0 ; row < count; row++); {
hour = empData[row][0];
wage = empData[row][1];

[Code] ....

I'm really stuck on this problem...Why is it in my salary column all it outputs its 0? How would i fix this ?

View 2 Replies View Related

C++ :: Reference To Column Is Ambiguous

Feb 18, 2014

I'm using GCC 4.8.1 and I want to implement a XML parser using TinyXML and port it to AngelScript

Now, it says: reference to 'Column' is ambiguous

I've declared a class called xml_parser and I've added everything of tinyxml as it's public member when I call Column(), and also Row(), it give's this error. what should I do?

This is it's code:

xml_parser.hpp:
#ifndef AGK_XML_PARSER_H
#define AGK_XML_PARSER_H
#define TIXML_USE_STL
#include <tinyxml.h>

[Code] .....

View 16 Replies View Related

C++ :: Matrix - Remove Row And Column

Jul 11, 2013

I suppose to have the following matrix

A). I want to remove a generic row and column. For instance the second row and column, then I get
B). How can I realize it in C?How to do.

A) B)
a00 a01 a02
a00 a02
a10 a11 a12a20 a22
a20 a21 a22

View 2 Replies View Related

C# :: How To Get Column Names From Db3 File

Oct 2, 2014

I have .db3 file, and he has 14 tables,and every table has certain number of columns. Example i have table called "BASIC_INFO" and that table has columns "First Name", "Last Name" and "Age".

How can i get name of table and name of every column,so if i some day add column "Male" i get name of this column too. I need first to calculate number of columns,put that in some integer, and then for example create string array which will contain : array[0] = "First Name" ,array[1] = "Last Name"...

SQLiteConnection myConn = new SQLiteConnection("Data Source=" + DB3Path + ";Version=3;New=False;Compress=True;");
//string query = "Select * From " + DB3Path + ".INFORMATION_SCHEMA.COLUMNS";
string query = "Select * From BASIC_INFO.INFORMATION_SCHEMA.COLUMNS;";
SQLiteCommand sqCommand = new SQLiteCommand(query);

[Code] ....

I tried this too:

string query = "select * from INFORMATION_SCHEMA.COLUMNS"
+ "where TABLE_Name='BASIC_INFO'"
+ "order by ORDINAL_POSITION;";
string query = "SELECT TOP 0 * FROM BASIC_INFO";

View 2 Replies View Related

C# :: Each Column With Different Datasource In GridView

Oct 7, 2014

I have question regarding Gridview.

Can i set each column in Gridview with different Datasource ? for example I create Gridview with 3 column , can I set each column with different datasource ?

View 2 Replies View Related

C# :: DataGridView CheckBox Column

Apr 24, 2014

I cannot check the checkbox in my datagridview.

Here is my code.

First, I added a checkbox column.

private void addCheckBoxColumn() {
DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
checkColumn.Name = "clmCheck";
checkColumn.HeaderText = "";
checkColumn.Width = 100;
checkColumn.ReadOnly = false;
dgv1.Columns.Add(checkC

[Code] ....

View 4 Replies View Related

C# :: Link Combobox With SQL Column

Oct 19, 2014

When I try to link combobox with sql column i get error !!

void comfunction() {
string constring = "Data Source=LC-VAIO\SQLEXPRESS;Initial Catalog=sample1;Integrated Security=True";
string query = "select * from tbltest";
SqlConnection cn = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand(query,cn);
SqlDataReader dreader;

[Code] ....

I got error from "string sname = dreader.GetString("name"); "

And this how i try to link it...

View 9 Replies View Related

C/C++ :: Replacement Column And Row Between Two Arrays?

Nov 23, 2012

You have two array and you want to replace the column of one of them to the row of another?

View 4 Replies View Related

C :: Check Same Integer In Row And Column In Matrix

Jan 8, 2015

I am new in c programming and my teacher gives me home word to do. the home work is to create dynamic matrix that check if i have same number in row or in column. for example the matrix

1 2 3
2 3 1
3 1 2

is legal matrix and this matrix is illegal

1 3 3
2 1 3
3 2 1

I created the matrix and sent it to function but there I don't know how build the code.

View 8 Replies View Related

C :: Check Random Numbers To Appear Once Or Twice Only In Each Row Or Column

Oct 25, 2013

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
#define rows 9
#define columns 9

[code]....

View 9 Replies View Related







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