I have this table Profile which has fields with user_Id and regNo and I want to check first if id and email are already exists before proceed to inserting datas. In my codes, I am able to validate only one row (either id or reg number), but if I am going to validate the two of them, it gives me an error, saying "Must declare the scalar variable @userid". I dont know if it is with my select that is wrong or something in my codes
SqlConnection con = new SqlConnection("Data Source=GATE-PCSQLEXPRESS;Initial Catalog=dbProfile;Integrated Security=True");
con.Open();
SqlCommand cmdd = new SqlCommand("select * from Profile where user_Id = @userid AND RegNo = @reg", con);
SqlParameter param = new SqlParameter();
How to validate if the item you want to add in the cart is already exists in listView items? for example I already add CH001 which is the productId of Chocolate strawberry, then I accidentally add again that product Id and I what I want is that it should not be accepted on my listview again because CH001 is already on my cart.
I have a dynamic storage class based on a vector. The elements of this class shall be addressable via a string.
I have something like the following:
StorageClass* test = new StorageClass(); while(notEnd) { test->setValue("name3", 3); test->setValue("name2", 4);
[Code] ....
The Storage class is implement with a vector having to attributes per entry, the first one is name the second one is value. If the setValue function is called, Igo through the whole vector to find the correct item via the name and than i set the new value.
At the end of the loop i want to write out the data into a comma separated value file (*.csv). This shall be done generic by the writeLineToFile() function of the StorageClass.
As a want the columns in csv file to be sorted in a specific way a thought about a preInitalisation routine at the beginning of the program which builds a the vector with all possible entries as something like this in order to define a specific output order.
I now have 2 places in the code where i write down the "fieldnames".
I was wondering if there is a possibility to check if the fields called by the setValue function were first aranged in the vector by the assigned() function before or bettwer while compiling the programm.
I thought about MAKROS with #define XYZ and #ifndef XYZ #error to do though, but currently i reached a dead end and find no solution for my problem.
I have to check whether or not a record exists in a join and if not ignore that user but still load all the other information for that user
var db = Simple.Data.Database.OpenNamedConnection("sqlConn"); var expr1 = db.PON_APP_USERS.STATUS == 1; var sUsers = db.PON_APP_USERS.FindAll(expr1) .Select( db.PON_APP_USERS.USERKEY, db.PON_APP_USERS.LAST_NAME, db.PON_APP_USERS.FIRST_NAME,
Q. In context of C language syntax checking, which of the following can be modeled using Finite Automata?
(A) Detecting proper termination of an instruction. (B) Detecting balance of parentheses. (C) Detecting initialization of a variable. (D) None of the above.
I think I may have found a new way of checking for 3d polygon collisions, but I'm not sure. The method involves...
1. finding the planes that the primitives lie on 2. finding the line where the planes intersect 3. if both polys have points on both sides of the line AND have points that overlap on the 1d space of the line, then they intersect.
I have some half done code testing this, and so far it seems to be sound and fairly fast. These are some average time-tests done on my machine for each part:
The above code would proceed to create a new array, store it in a pointer and retrieve the memory address of the array before finally deleting the array.
So let's assume we re-build the pointer and try to access the now deallocated array:
Pointer = ( uint32* ) MemAddr; Pointer[ 0 ] = 0;
Based on the above snippets of code, how would I check "Pointer" after rebuilding the memory to check if the rebuilt memory has actually been deallocated. Without a check we'd get an exception error.
A bit of detail on why I am trying this:
Before thinking up how to do this, I was storing the addresses in a list and check the list for the addresses to see if they existed or not. However this requires an O(n) search, which isn't exactly what I am wanting. So instead if I used a check for deallocation method, I can go for an O(1) time check and reduce the total time it would take to check for memory allocation/deallocation.
I have created a prompt which prompts the user for an integer and I have set up a loop to check for if it is an integer or not. My "bug" is that a user can enter an "integer" and "space" and "enter" and it does not give any error and assumes that "All is FINE!". I have gotten the value from the ascii table of 'SPACE' and put it as a check in my parameter of while, but it does not work.
Here is my code:
int x, y, boolean, i; char buff[256]; printf("Enter the first integer value: "); scanf("%s", buff); i = 0; boolean = 0; //initializing our boolean var that will eventually decide if we have an error or not
template <typename T> class Matrix { // some stuff and some methods };
and let's say that you have some methods that need to do some type-dependent stuff, like, for example,
template <typename T> Matrix<T> Matrix<T>::transpose() const { // get this->rowCount, this->columnCount // create a Matrix that has rowCount amount of columns and columnCount amount of rows // copy (*this)[j][k] to theMatrix[k][j] (for all of the entries in *this) // if the entries are complex, take the complex conjugate of them all }
Would it be good practice to check explicitly for the typename parameter (or is this, somehow, defeating the purpose of templates)? std::cout << "I know that this is a design question, but it needs to be asked... ";
I'm playing around with parts of code and am coming across some errors. Most of my concern is related to strtok(). I've used it before but with a char* named token. I used a while loop to continuously check whether token was equal to NULL. In the following code, however, there aren't any checks. I was wondering if that is why this code prints (null) while running. Also, I would like to know if it is possible to read input like this code attempts to do - assigning tokens to each variable one after the other.
Assuming I have a list of pointers to a generic type T:
#include <vector> //... list<T*> myList;
Now assuming I want to go on the list, and if T's type is matched to the type I'm looking for, then cast it to this type and do something. List shown here:
How to check whether the denominator .. (meanyy)- (meany * meany)) is zero ? Cause its float.
can I check with ..
float f1 = (meanyy) - (meany * meany) ;
if (f1 == 0.0) ..
Will this work surely ? I am using this formula in project based on winXP but it survived. As soon as I ported the code on DPMI based code , I observed a system hang after some time if all the points I supply are (0,0) while drawing a line.
wrote this program to check if a string is an integer. It checks for + or - sign at the front of it, but it spat out some errors.I think I broke it.Here is the code:
Code:
#include<stdio.h> #include<ctype.h> #include<stdlib.h> int getInteger(char*); int main(void) { char str[99]; int x; }
Code: #include <stdio.h> #include <stdlib.h> #define MAX_READ 2 int main( ) { char * secret = "abecedarium consisting This is a string literal!";
[Code] ....
I am trying to test what happens in the sscanf converted types (command and string) if they are smaller, i got surprised that the printf worked, so i dont know why.
this code is just a test for what i want to do, what i really want to do is for example: i have this string from the stdin which must have the following format:
connect name.surname
So I need to check the cases when it is not the input that i want, namely if the name.surname is for example bigger than 30 chars. and also if it has the abecedary characters from the ascii...
If I want to check if all the variables are pairwise distinct, i.e. they're all different. Here's a code I wrote to do this:
if (s!=e&&s!=n&&s!=d&&s!=m&&s!=o&&s!=r&&s!=y&&e!=n&&e!=d) if (e!=m&&e!=o&&e!=r&&e!=y&&n!=d&&n!=m&&n!=o&&n!=r&&n!=y) if (d!=m&&d!=o&&d!=r&&d!=y&&m!=o&&m!=r&&m!=y&&o!=r&&o!=y&&r!=y)
Is there perhaps some function that would let me do this in a lot shorter way, i.e. something like this (that would act the same way my other code does): if (different(s,m,d,e,o,n,y))
What is the best way you can think of? Without having all those variables in an array. Otherwise it wouldn't be so hard to create a function.