C Sharp :: Using List Elements As Variable In Query

Aug 27, 2014

I am trying to query an Informix database using a List<T> collection's elements as variables. I can build the list and connect to the database, but I am unsure how to iterate through the list and query the database for each item in the collection.

My list is of type string, and contains Order Numbers. I want to query item information for each order number in the list.

View 1 Replies


ADVERTISEMENT

C Sharp :: Open Excel File / Refresh Query And Save

Oct 3, 2012

I am trying to open an Excel file, refresh the query behind it and then save and close the file in C#.

I have the following but I am getting errors on the

 Application excel = new Application()

section:

            Application excel = new Application();
            Workbook theWorkbook = excelFile.Workbooks._Open(txtLocation.Text, 0, false, 5, System.
Reflection.Missing.Value, System.Reflection.Missing.Value, false, System.

[Code] .....

I have added the Microsoft.Office.Interop.Excel reference, but still have the issue?

View 1 Replies View Related

C Sharp :: Syntax Error In Update Query Using MA Access Database And Net 4.0

Feb 21, 2014

private void update_Click(object sender, EventArgs e)  {
            OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:UsersshobhitDocumentsEnvironment_Monitoring.accdb;
Jet OLEDB:Database Password=divya6");
            String sdat = dateTimePicker1.Value.ToShortDateString();
            String la = labs.SelectedItem.ToString();

[Code] ....

View 1 Replies View Related

C++ :: Generate List Of Tokens For A Query

Jun 9, 2013

I'm trying to solve the following problem:

Given a query, find all possible tokens, i.e. query-splits

Example:
query = New York Hotel
tokens = {New, York, Hotel, New York, New Hotel, ...., New Hotel York, Hotel New York, ...}

Given a query with word count n, the total number of tokens is:
n + n*(n-1) + n*(n-1)*(n-2) + ... + n! (any explicit formula available for this sum?)

Now, I have came across various code snippets to generate permutations for a string, but never for a sentence.

View 13 Replies View Related

C :: Assigning Array With A Variable Number Of Elements

Jul 18, 2014

I have a simple problem about memory allocation.In the function Nr_elements() i assign a value which represent the elements of array. The pointer p is initialised with the address of variable n, but when i compile i dont know why but dont work. This function return a pointer.

Code:
#include<stdio.h>
#include<stdlib.h>
int *Nr_elements();
int *allocate(int);
void deallocate(int *);
[code]....

View 3 Replies View Related

C Sharp :: Comparing For Common Elements In Multiple Lists Using Intersect In C#

Mar 20, 2013

I have a dynamic number of lists coming in from a different method . i need to find out the common elements present in all of the lists .

How do i do it with intersect construct in C#.

Placing it in a loop gets me the elements common in the last comparison , but never gets me elements commong in all lists.

View 1 Replies View Related

C++ :: How To Access Elements In A List

Oct 18, 2013

I've been looking through containers in the reference section and I can't figure out how to access (i.e. READ) elements in a list...

View 2 Replies View Related

C++ :: Counting Of Elements In A List Of Lists

May 1, 2013

I have a problem like this: I do not know how to count the number of elements in a list of lists. I have the following list of list.

#define VAR(V, init) __typeof(init) V=(init)
#define FOR_EACH(I,C) for(VAR(I, (C).begin()), ite = (C).end();
(I) != ite;
++(I))

std::vector<std::vector<GLdouble> > contours;

[Code] ....

I do not know how to write the part indicated in Bold that represents the number of elements of contour. As seen from the code used for the tesselation OpenGL.

View 3 Replies View Related

C++ :: Watch Elements Of A List In Debugger?

May 11, 2014

How can i look into the element that are pushed into the list. Something like listPointer[0].heapPointer,50

class CA{
public:
CA(void);

[Code].....

View 3 Replies View Related

C++ :: Returning The Number Of Elements In A List

Jul 24, 2014

I am given an array with n elements but need to write a function where it returns n-1 elements. Do I need a loop for this? Or must I write a prototype...

Here is what I have thus far:

//given array with 5 elements function must return value 4 elements since -1 is a special character length of list is finite

#include <iostream>
using namespace std;
int main () {
int array [] = {1, 4, -1, 3, 2};
cout << "The array has " <<sizeof (array)/ sizeof (int)<< " elements"<< endl;
return 0;
}

View 5 Replies View Related

C++ :: Displaying All Elements In Linked List

Aug 31, 2013

#include<stdio.h>
#include<iostream.h>
struct node {
int info;
struct node *next;

[Code] ....

I am getting runtime error in some cases. Sometimes the last input is printed. How to correct the code and display all elements in the linked list.

View 6 Replies View Related

C :: Enter Number Of Elements In Linked List

Aug 15, 2014

Code:
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;

[Code] .....

View 2 Replies View Related

C++ :: Linked List BubbleSort - Number Of Elements

Apr 22, 2013

Why isn't this bubble sort working?

void LList :: bubbleSort (LList A, int n){
Node *temp;
temp = Head;
int hold;
for (int pass = 1; pass <= n-1; pass++) // number of passes needed for bubblesort is the number of elements-1 {
for (int c = 0; c < n-pass; c++)//only runs for unsorted elements

[Code] ....

It is passed the LList, and the number of items in the list...

View 6 Replies View Related

Visual C++ :: Template - Adding Elements To List

Jun 9, 2013

I'm doing a homework aasignment on templates, and i have to build a list. The problem starts when i am trying to add elements to the list. For instance if i chose to add 5 different elements (1,2,3,4,5) the output will be (5,5,5,5,5).

Code:
void add_back(T t){
Node* tmp = new Node;
tmp -> m_data = &t;
if(m_head == NULL) {

[Code] ....

View 4 Replies View Related

C++ :: Singly And Doubly Linked List - Order Inserted Elements According To Certain Pattern

Sep 13, 2014

I need to make singly and doubly linked list classes that can insert elements. Once the lists are created, I need to order the linked list elements according to a certain pattern.

order2 pattern:
input: 0 1 2 3 4 5 6 7
output: 1 0 3 2 5 4 7 6

order3 pattern:
input: 0 1 2 3 4 5 6 7 8 9 10 11
output: 2 1 0 5 4 3 8 7 6 11 10 9

sequence order pattern:
input: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
output: 1 0 4 3 2 8 7 6 5 13 12 11 10 9

reverse pattern:
input: 0 1 2 3 4 5 6 7 8 9
output: 9 8 7 6 5 4 3 2 1 0

My instructor has given the description of the required classes in a file interfaces01.h as:

#pragma once
#include <cstdlib>
struct ISingleNode {
ISingleNode() {}
virtual ~ISingleNode() {}
virtual void setValue(int value) = 0;
virtual int getValue() = 0;

[Code] ....

However when I am compiling these files in vs 2013 I am getting the error: cannot open include file Singlenode.h,Singlelist.h.

Also I am not too sure about the sorting and reverse logic. How can I implement these logics.

View 1 Replies View Related

C Sharp :: Converting DB Variable To Double In C#

Aug 22, 2012

I'm having some trouble with a variable from a database. That variable in that database is of type double.

To read from the database, I'm using a variable dr of type OleDbDataReader.

So far, I've been using dr["variablename"].ToString() to work with the variables from this database - without the ToString part it wasn't working.

However, with this specific variable (I'll call it "var"), I have to do numerical comparisons of >= and <=, so obviously, just using dr["var"].ToString() doesn't work.

Therefore, I tried creating a variable of type double called varConv and setting it as

varConv = Convert.ToDouble(drPen["var"].ToString()).

That doesn't work, gives me an error message saying "Input string was not in a correct format". If I remove the ToString part, it also doesn't work, with a different error message saying "Object cannot be cast from DBNull to other types".

Trying to do a direct comparison, as in dr["var"] >= x also doesn't work, says "Operator '>=' cannot be applied to operands of type 'object' and 'int' ".

View 3 Replies View Related

C Sharp :: Search A Record In SQL Table Using Datetime Variable

Jan 1, 2014

I have an application in C sharp that searches for a record in a sql database using a datetimepicker,the output is displayed in a datagridview.When I execute it I got a blank datagridview with empty columns.I can not view the content and I don't get any error message.

Here is my code:

DataTable dt=new dataTable();
SqlDataAdapter sda=new sqldataadapter("select * from Delivery where convert
(char(20),Delivery_Date,112)='"+ dateTimePicker1.value.Date,con);
//con is sqlconnection
Sda.Fill(dt);
Datagridview1.DataSource=dt;

View 1 Replies View Related

C++ :: Insert Variable For Size Of Array And Prompt User To Insert Elements

Dec 1, 2013

how to insert a variable for the size of array and prompt user to insert the elements for the array?

View 13 Replies View Related

C Sharp :: Store Values In Variable Permanently Even After Restarting Machine?

Dec 26, 2013

I want to store values permanently in a variable. The same variable should be able to be edited and saved by user, and whatever it is I need the value of the variable from the last time I modified it, like a database. database because i need this to set my connection string of the database.

View 1 Replies View Related

C# :: How To Add List To Array Variable

Aug 8, 2014

I'd like to do something like this:

private List<Vector2> myVectors = new List<Vector2>();
private List[] myListOfListsOfVectors = new List[10];
for (int i = 0; i < 10; i++){
myListOfListsOfVectors.Add(myVectors);
}

Or better yet, if I can create 10 lists called "myVectors" and access their objects by "myVectors[1][objectIndex];"

View 5 Replies View Related

C Sharp :: How To Bind DropDown List

Feb 16, 2013

<asp:TemplateField HeaderText="Group_Id"> 
<ItemTemplate> <asp:Label ID="G1" runat="server" Text='<%# Eval("Group_Id") %>'></asp:Label> 
</ItemTemplate> <EditItemTemplate> <asp:TextBox ID="G2" runat="server" Text='<%# Eval("Group_Id") 

[Code] ....

on running i find this error

Compiler Error Message: CS1061: 'ASP.webform12_aspx' does not contain a definition for 'Group_Item_Name_SelectedIndexChanged' and no extension method 'Group_Item_Name_SelectedIndexChanged' accepting a first argument of type 'ASP.webform12_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 143: </EditItemTemplate>
Line 144: <FooterTemplate>
Line 145: DropDownList ID="G3" runat="server" AutoPostBack="True"
Line 146: onSelectedIndexChanged=" Group_Item_Name_SelectedIndexChanged" Width="133px">
Line 147:</asp:DropDownList>

View 1 Replies View Related

C Sharp :: Convert A List To Buttons

May 27, 2012

I have a txt file of drinks, and I want to meak a list of buttons of it (the txt file is build like this: fanta : 2 ), how can I make buttons of all the drinks ( I get the first one in a button , but not the others).

Dictionary<string, double> drank = new Dictionary<string, double>();
     string[] words = new string[8];
     Button button;
     <Button> BtnList = new List<Button>();

[Code] ....

View 1 Replies View Related

C Sharp :: Convert Dropdown List To Int Datatype

Mar 16, 2013

I am need to compare 2 items from 2 separate drop down lists. These values are of int type. Say for example 2 drop down lists showing years. Now i need to find out these 2 years selected is greater or nearer to the current year.

I tried converting the values i receive from the drop down lists to int variables. But i am getting error then. I gave it like below.

int tmp = Convert.ToInt32(ddl_1.SelectedItem.Text);

this gives an error like this - Input string was not in correct format.

I need to know how to put an item from a drop down list to a variable of int data type.

View 1 Replies View Related

C Sharp :: To Create Globe List Of Templates

Jun 23, 2012

//////////////////////////////////////////////
struct FaceTemplate {
public byte [] templateData;
}
List <FaceTemplate> faceTemplates;
////////////////////////////////////////////

I want to create this structure as globally to access this list in every window form. how can i create and how cam i access.

View 1 Replies View Related

C/C++ :: Store Initial Size Of List In Int Variable?

Nov 24, 2014

I've been trying to store the inital size of a list in an int variable, so I can access it later in case I modify the list size. For example, I did the following:

std::list<AType *> myList;
myList.push_back(anATypeobject);
int initListSize = myList.size(); //initial list size
myList.push_back(anotherATypeobject);
myList.push_back(yetanotherATypeobject);
while(myList.size > initListSize)
myList.pop_back();

What this is supposed to do is to get an initial size of a list, and then be able to return to that initial size. However, when I try to do it in my code, initListSize always change if myList.size() changes. Is there a way to change that?

View 4 Replies View Related

C Sharp :: Display SQL Database Record In List View Using C#

Oct 6, 2012

I want to display the content of my database in list view. The table has 5 columns however when I tried this code

string view = "Select * from cust_infor";
SqlCommand cmd = new SqlCommand(view,FL.clsconnection.opencon());
            SqlDataReader dr = cmd.ExecuteReader();
            listView1.Items.Clear();  
            while (dr.Read())  {
                listView1.Items.Add(dr[0].ToString()).SubItems.Add(dr[1].ToString());  
           }  

It limits the display to 2 columns. List view will only show the first 2 columns. The code above won't let me add more indexes or subitems. Only up to 2 columns.

View 1 Replies View Related







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