Visual C++ :: Getting Error While Retrieving Value From ADO Recordset
Jul 21, 2013
I have a vc++ project file which reads data from access 2007 database.
I have successfully declared and opened connectionPtr and recordSetPtr objects.
The follwoing code is giving an error message that "item cannot be found in the collection"
stringVar = (recordSet->Fields->GetItem("[String]")->GetValue()).bstrVal;
If i replace "[String]" with "String" then above statement executed successfully.
How can i execute the above statement with "[String]" without errors?
View 4 Replies
ADVERTISEMENT
Aug 6, 2014
I have issues for the following piece of code :
Code:
#include <string>
#include <fstream>
#include <iostream>
#include <cstdlib>
[Code] ....
I get errors retrieving the grade values extracted, and then I get a run time fault.
View 3 Replies
View Related
Feb 25, 2013
What is the efficiency of the two assignments (line 1 and 2), i.e. (function calls, number of copies made, etc), also the Big O notation. I know there are function calls for retrieving the size of each string in order to produce a new buffer for the concatenated string...any difference between line 1 and 2 in terms of efficiency?
String s("Hello");
String t("There");
1. s = s + t;
2. s += t;
View 3 Replies
View Related
Sep 25, 2014
I have the records "File attached"
My query is
from c in JOB_HISTORies join d in DEPARTMENTs on c.DEPARTMENT_ID equals d.DEPARTMENT_ID select new {d.DEPARTMENT_NAME,c.START_DATE,c.END_DATE}
How do i put the record Accounting in the same row to avoid duplication.
View 4 Replies
View Related
Sep 18, 2013
I have a C# program going and want to be able to call the DLL and receive back the data requested through a pointer.Below is the DLL import within my C# code.
Code:
[DllImport("MyTest.dll")]
public static extern int ReadNetwork(Byte[] ROM_ID); Below is the code in the DLL Code: int _stdcall ReadNetwork(unsigned char* Array1)
{
ReadDevice(readBackArray);
for(i = 0; i < 20; i++)
{
Array1[i] = readBackArray[i];
}
[code]....
I've tried changing the return values in the DLL's ReadNetwork() function and that works ok, so I know I'm calling the DLL and it runs ok, but printing the result back is where I'm having the problem.
View 2 Replies
View Related
Apr 25, 2013
I am trying to retrieve the first three bits of a number. The code that I am using should work but it isn't giving me the correct result when trying certain numbers. Below is the code I am using:
unsigned short num1, num2 = 0;
unsigned short num = 65535// binary 111111111111111
num1 = num && 0x07;// gives me 1 but should give 7(111)
num2 = num >>3;//gives me 8191, which is correct
Why I am not getting the first three correct bits(111)?
View 2 Replies
View Related
Oct 3, 2013
When i execute the program it gets the right data for the first array but the scound either doesn't work at all or just gets to much data. i've tryed using getline and the "cin" for what the file would be in this case "myfile" there is also one more array that must be retrieved from the file.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
[Code].....
View 4 Replies
View Related
Nov 30, 2013
I was struggling the last 2 days with this C script supposing to open a list of strings (input as fopen(argv[1])and allowing to access to any element of the list. I created an array *gcm[10000] and a pointer *(*gcm_ptr[10000] = &gcm. However, when I try to list whatever n[i], it always gives me the last entry.
View 4 Replies
View Related
Apr 18, 2013
I have a text file config.txt which has:
"red = true"
"blue = false"
"children = 10"
I want to write a code that reads the values of these variables red, blue and children when executing the code.
I have something like this:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main () {
ifstream Configure;
[Code] .....
I want to read the read the values of red, blue and children in and use them when the program executes.
View 1 Replies
View Related
Mar 7, 2015
I'm writing a simple text adventure style program in order to practice C++. I originally used char to get whether the user wanted to go north, south etc, requiring they enter W, A, S, or D, and then I used a switch statement, rather than a bunch of else if blocks to move in the appropriate direction. Last night I started updating the code and wanted to require the user type an actual string like "go north" to move, so I'm in the process of converting it over to getline();.
The way it works is the user will input "go north", and if the string is equal to "go north" it will set a variable to 1, 2, 3, or 4, so I can keep the switch statement. The program compiles but whenever it asks for user input, it always hangs waiting for 2 separate lines of input regardless of whether or not you put a space between your command. The move function is as follows:
void movement() {
bool loop = true;
int roomNorth = 0;
int roomWest = 0;
int roomSouth = 0;
int roomEast = 0;
int dirOption;
string dir = "";
[code]....
I read that it could be an issue with getline and the new line characters, which is why I added the cin.ignore in there...so yea the code will wait for 2 separate lines of input and then always outputs "Invalid direction!" regardless of the input.
View 3 Replies
View Related
Jan 2, 2014
I want to get or view the SIM card number from the dongle (the dongle will b already connected to the computer where the SIM card will be inserted into it) but the coding should be done by C programming / Language.
View 5 Replies
View Related
Jul 14, 2013
I am supposed to make this phone book save to a file and then be able to retrieve it.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Phonebook_Contacts
{
char FirstName[20];
char LastName[20];
char PhoneNumber[20];
} phone;
}
[code]....
View 4 Replies
View Related
Jun 30, 2014
Suppose your program has many concrete subtypes of Person, and each person will have their own file saved, with their type stored in that file. When reading the files to create the people again (of their proper types), what is the best method to maximize performance (and elegance by shortening the code)? Here is what I have so far.
First I used if statements, which is terrible, and now I've improved the performance logarithmically using std::map. I still suspect there is a better way, especially if there are going to be hundreds of different classes. If you want to test it, you can change the PATH constant to whatever path you want, or just leave it as an empty string, and the files will be created in the same directory as your cpp file. The part I'm trying to improve is pointed out in the comments.
struct Person {
std::string name;
Person (const std::string& newName) : name (newName) {}
virtual ~Person() = default;
};
struct Guy : Person {using Person::Person;};
struct Girl : Person {using Person::Person;};
[Code] ....
View 4 Replies
View Related
Nov 28, 2012
I have to store large amount of data and retrieve the same data then write into file in C++. Currently I am using vector to store and retrieve. But vector is taking more time to store and retrieve the element. Is any other best data structure to store and retrieve large amount of data in unordered way?
Example code:
int I1 = 700,I2 = 32, I3 = 16;
//declare and resize the vector size
vector< vector < vector < vector<DOUBLE> > > > vPARAM;
vPARAM.resize(I1, vector< vector < vector<DOUBLE> > >
[Code] ....
View 3 Replies
View Related
Sep 19, 2013
My specific request is for retrieving values that are stored to a CompactFlash card. I am able to store values (we call them recipes) to the CompactFlash card as .csv file. I just haven't been able to figure out the code to retrieve this information back to the touchscreen.
Code:
// Create a new folder if it doesn't exist
CreateDirectory("/recipes");
//Create the file if it doesn't exist
CreateFile("/recipes/recipe.csv");
//open the file
hfile = OpenFile("/recipes/recipe.csv", 2);
[Code]....
Now with that said, I would like to retrieve these values from the .csv file.
View 7 Replies
View Related
Sep 15, 2012
I am trying to retrieve the parameters from externally connected pendrive. I have been using WMI to achieve this but not able to separate the pendrive's parameters from the other USB devices (such as USBcamera,USBHub etc) ....
View 2 Replies
View Related
Jan 2, 2013
on a customers pc I have the following problem:
I want to run an exe file with CreateProcess, but this generates the error 193 which means
ERROR_BAD_EXE_FORMAT
%1 is not a valid Win32 application.
This is strange because there are no known problems with this file before for many years on many different windows versions.
The customers uses win7/32.
I use it with win xp and win7/64.
The file was compiled with vc 6.0.
What can cause this problem?
View 14 Replies
View Related
Jun 19, 2013
I load an image(768*256) using a file path(OpenImageFilePath).
After load an image, I start to read the loaded Image data using GetBits method and plot the same image data(768*256).
I'm using the memcpy method, for that i'm getting the below error. memmove function also giving the same error message.
File Name : memcopy.asm
rep movsd ;N - move all of our dwords
Code for your reference
Code:
void CDlg :: FileOpen() {
CFileException CFileEx;
CStdioFile ReadFile;
// szFilters is a text string that includes two file name filters:
TCHAR szFilters[]= _T("Image Files (*.bmp)");
[code]....
View 14 Replies
View Related
Feb 3, 2014
I have a problem with ReadFile and overlapped.
first I use ReadFile with overlapped with 0
Code:
ZeroMemory(&overlapped ,sizeof(OVERLAPPED));
hDevice = CreateFileW(zwpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
if(hDevice != INVALID_HANDLE_VALUE){
[Code]....
View 2 Replies
View Related
May 28, 2013
Here is the error I am getting:
1>d: estprojectgdiplusrenderer.h(61): error C2872: 'Font' : ambiguous symbol
1> could be 'c:program files (x86)microsoft visual studio 10.0vcincludecomdef.h(312) : Font'
1> or 'c:program files (x86)microsoft sdkswindowsv7.0aincludegdiplusheaders.h(244) : Gdiplus::Font'
How can I fix this issue?
View 2 Replies
View Related
Jan 28, 2013
The following code it taken from msdn library but it is failing to compile.
the following code has a header where all the variables used here are stored in header App.h.
The following lines are giving trouble:
Code:
DialogBox(pApp->getInstance(), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, pApp->About);
error: 'App::About': function call missing argument list; use '&App::About' to create a pointer to member
Code:
wcex.lpfnWndProc= &App::WndProc;
error: '=' : cannot convert from 'LRESULT (__stdcall App::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
There is no context in which this conversion is possible
Here is the complete code:
#include "stdafx.h"
#include "App.h"
App::App(void) {
}
App::~App(void) {
[Code] .....
View 4 Replies
View Related
Mar 11, 2013
I am working through these tutorials:
[URL]
I haven't had to modify them much for VS2010 so far. Right now, (I think) I have created the dialog box, and the menu as a class and a resource, respectively. However, when I call
Code:
void MFC_Tutorial_Window::OnClickDialogNew()
{
NewDialog dlg;
dlg.DoModal();
}
I get an error 'DoModal' : is not a member of 'NewDialog'
I suppose somehow I need to link the menu to the dialog box?
I believe I've added the references, included the libraries and essentially followed the instructions. Apparently I'm not very clear on how to make resources interact with new classes.
View 9 Replies
View Related
Aug 23, 2014
I have this code in my project
Code:
// OpenGL1.cpp : main project file.
// #include "stdafx.h"
#include "windows.h"
#include <GL/gl.h>
[Code] ....
and I got this error:
Configuration: Debug Win32 ------
1> OpenGL1.cpp
1>LINK : fatal error LNK1104: cannot open file 'C:Program FilesMicrosoft SDKsWindowsv7.0AIncludegl.obj'
Why it wants the gl.obj and how to make this code working without error?
View 3 Replies
View Related
Sep 22, 2013
I am getting an error...
Error1error C2109: subscript requires array or pointer type451
PHP Code:
#include "stdafx.h"
#include <conio.h>
#include <iostream>
using namespace std;
//Function prototype
int searchList (const int [ ], int);
[code].....
View 3 Replies
View Related
Nov 3, 2014
I have an assignment where i have to prompt the user to enter the name of a file then open that file and read names of students and what level they are at university
eg : John Wilkins, sophomore
Dan Robertson, junior
etc..
i did the code and it compiles perfectly, but when i input the name of the file it gives me error: string subscript out of range.
here's the code:
Code:
#include <iostream>
#include <cstring>
#include <string>
#include<ctime>
#include <fstream>
using namespace std;
int * read_file(string filename)
[code]...
View 2 Replies
View Related
Nov 22, 2012
I've got
[tranlated]
Code:
error C1083: cannot open: '[!output PROJECT_NAME].h': No such file or directoryd:program files (x86)autodesk3ds max
2012maxsdkhowto3dsmaxpluginwizard emplates1033atmospheric_type_atmospheric.cpp1513dsmaxPluginWizard
I opened the project
Changed it to vc100
Changed it to x64
Disabled optimization
And compiled
And the results are shown above
View 1 Replies
View Related