C# :: SQL Database Not Saving?
Oct 5, 2014
My program add something in a data base, but after program is closed all data is removed.
conturiSQLDataSet.LoginsRow newUserRow = conturiSQLDataSet.Logins.NewLoginsRow();
...
conturiSQLDataSet.Logins.Rows.Add(newUserRow);
There is a method that program can save all data?
View 2 Replies
ADVERTISEMENT
Mar 17, 2014
I want to connect an access database (.mdb) to my Windows Forms application - this I can do and I have no problems viewing my table in server explorer.
Some code example or template that I can use as a base to learn from - I have literally trawled Google and Youtube and cannot find what I am after.
What I want to do is have a basic form, 2 text boxes and a button to save the data to my database.
FirstName and LastName are the 2 boxes.
View 6 Replies
View Related
Jun 1, 2013
Ihave a gridview which populated via selected item on my drop down list which I don't have any problem with that. My problem is I am trying to save multiple rows on my gridview into my database, for example I have added 3 items on my gridview which looks like this:
Id | Name
111 | Jack
222 | Nicole
333 | John
Now, I want all that under column Id which is 111, 222 and 333 will be save on my database once I click Save button I am trying the code below but it gives me an error saying "system.data.sqlclient.sqlparameter does not contain a definition for 'Values' and no extension method 'Values' accepting a first argument of type..." :
SqlConnection con = new SqlConnection("Data Source=GATE-PCSQLEXPRESS;Initial Catalog=dbProfile;Integrated Security=True");
SqlCommand cmdd = new SqlCommand("Insert into profile (Id, profile_id)VALUES(@id, @profile_id", con);
foreach (GridViewRow row in GridView1.Rows) {
[Code] .....
My table should be look like this once I am able to save multiple rows from my gridview into my database:
auto_id | Id | profile_id
1 |111 | 101
2 |222 | 101
3 |333 | 101
I am using asp.net with c#.
View 1 Replies
View Related
Feb 12, 2014
Code:
#include<stdlib.h>
FILE *Ptr_file;
Ptr_file =fopen("output.txt", "w");
struct person {
char arcFName[50],arcMName[50],arcLName[50],cGender[2];
int nDay[2],nMnth[2],nYear[4];
[Code] .....
Alright I wrote this code, i know there's some mistakes but how do you go about saving its output into a txt file?
View 4 Replies
View Related
May 23, 2013
Here's my code, my problem is that it is not sending the keystrokes to the LOG.TXT file I want them to be going to.
1 #include <iostream>
2 using namespace std;
3 #include <windows.h>
4 #include <winuser.h>
5 #include <stdio.h>
6 int save (int key_stroke, char *file);
[Code] ....
View 1 Replies
View Related
Nov 1, 2013
I'm trying to serialize and deserialize objects, some static (that works) one moving (doesn't work). In the code you can see that the following int-variables discribe the moving circle:
object->phaseFarbe=phase1;
object->phaseKoord=phase;
object->rot=a;
[Code].....
View 1 Replies
View Related
Mar 16, 2015
I know how to save/open files but im just confused on where to write the code for it in this block of code :
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int NUM_MONTHS = 12;// Number of months
const int NUM_CATEGORIES = 6;// Number of categories
[Code] .....
View 5 Replies
View Related
Jun 23, 2014
The code posted in the spoiler is for a text file that I am saving text in. I get a 0x80004005 GDI Error on the line in the second code block. Data.BadgeData is a string[,].
Spoiler
-Its Where the code is at
public void SaveData()
{
string FileData = Data.FileLocation + @"BadgeData.Txt", Temp = string.Empty, FolderData = Data.FileLocation +@"ID" ;
[Code].....
View 14 Replies
View Related
Sep 27, 2014
I have this random number
List<string> ImageList = new List<string>();
ImageList.Add("Assets/Images/Image_0.jpg");
ImageList.Add("Assets/Images/Image_1.jpg");
ImageList.Add("Assets/Images/Image_2.jpg");
[Code] .....
The problem is that It generates a random number that can be the same as the last time. So I figured out, that I need to save my random number so I can use it later, as a if statement.
If saved number == r then it generates a new number.
how to save my generated number on OnNavigatedFrom method.
View 8 Replies
View Related
Jun 24, 2013
I have a 64-bit uint64_t number:
Code:
Primitive<uint64_t> b = 0xCCCCCCCC00000000; I need to save the first 31 (most important) bits - 7FFFFFFE.
I found this solution in the Internet:
Code:
start = (((b)>>(first)) & ((1<<(((last+1)-(first))))-1)); but in my case for this code:
Code: Primitive<uint64_t> start = (((b)>>(32)) & ((1<<(((63+1)-(32))))-1));
I get an error: left shift count >= width of type
And even if I change 63 to 62:
Code:
Primitive<uint64_t> start = (((b)>>(32)) & ((1<<(((62+1)-(32))))-1));
I get: error: integer overflow in expression
View 5 Replies
View Related
Jan 12, 2014
I want to take the informaition from this file and save it into a struct the file conteins name age year (in char) and a grade it is somthing like this
file
Nikos Tolis 19 A 8
Iwanna Nikolaou 20 B 9
Kwstas Doukas 20 Β 6
Georgios Pappas 19 A 7
Iwannis Lekatis 20 Β 7
Nikos Ntoumas 19 A 5
Maria Oikonomou 20 B 6
Kwstas Argyrou 19 A 10
Irw Ntouma 20 B 8
Leuteris Doukas 19 A 6
I want to read till i found the '32' the space in ascii here is my code so far
Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct students
{
char *name;
int age;
[Code] ....
View 2 Replies
View Related
Feb 21, 2015
My project involves writing a c program to generate a set of 70 decimal numbers. I want to save the output (these 70 numbers) as a txt file. I tried the following:
1. prt scr of output screen and pasting it in notepad. NOT WORKING
2. going to DOS SHELL and doing the following:
c:TCBIN>output.exe>>output.txt
NOT WORKING. Text file is generated, but it does not contain output. It just says:
illegal command: output.exe
What do I do?
View 2 Replies
View Related
Dec 4, 2014
I'm taking a programming class and currently we're doing data structures. Today, we discussed how to save square matrices column-wise with data structures. The teacher said that after the first few steps where you declare the structure, allocate the matrix, free it and get the dimension (which mostly make sense to me I think), you have to "get" and "set" the matrix by putting in something like
Code:
void setMatrixEntry(Matrix* A, int i, int j, double Aij) {
A->entries[i+j*A->m] = Aij;
}
[Code]....
View 7 Replies
View Related
Jul 18, 2014
I am receiving packets of data from an ethernet cable. This is the line of code that is streaming in data from the ethernet cable:
size_t num_rx_samps = rx_stream->recv(&buff.front(), buff.size(), md, 3.0, enable_size_map);[code]
Here are the segments of me trying to push the packets onto a vector:
[code]
std::vector<size_t> processing_queue; //HERE IS WHERE I'M TRYING TO PUSH THE PACKETS ONTO A VECTOR
processing_queue.push_back(num_rx_samps);
[code]
I previously had my program saving to a .dat file (the commented out lines), but I need to change it to pushing values onto a vector so I can stream the data packets from the ethernet cable to be processed. However, the packets aren't being pushed onto the stack as I suspected. What do I need to change to push the data packets onto a vector? The following is the code:
[code]
#include <uhd/types/tune_request.hpp>
#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <uhd/exception.hpp>
#include <boost/program_options.hpp>
[code]....
View 1 Replies
View Related
Jan 29, 2013
Why my code is not working?
Interface
class Person{
private:
char name[80];
short age;
public:
void get_data();
[Code] .....
This is a simple example from and old Lafore C++ book, with a few tweaks by me. The point is simple. Save object person to a *.dat file, exit the program, then start up program again, open up *.dat file, and load contents.
The first problem is the compiler is printing a bunch of Asian characters to the file (is this normal?)
The second problem is, it's not loading the object as it should, giving me a bunch of gibberish.
View 9 Replies
View Related
Nov 3, 2013
I have been coding a while on a 2D random terrain game. How would I go about saving the maps? I have an array for blocks, lighting, background and background lighting. The lighting is done in real-time, so exclude that.
But with two 32000x3200 arrays, I still need to store 204800000 separate numbers in a file. Oh god. How can I have this? I could write down the separate numbers, but...yeah.
If it matters, this is made in freeglut.
View 2 Replies
View Related
Sep 13, 2013
I have a problem when i try to save unicode to a .txt file.
I need to store in a file names that will have letters like "ăĂâÂșȘțȚîÎ"
wchar_t name []=L"ăĂâÂșȘțȚîÎ";
FILE* fang;
fang= _wfopen( L"test.txt",L"wt+,ccs=UNICODE");
fwprintf (fang, L"%ls ",name);
When i open my text file i get this: ??âÂ????îÎ
if i use
fang=fopen("test.txt","a");
I get the same result
and for
fang=fopen("ang.txt","a,css=UNICODE");
I get a runtime eroror "invalid file open mode"
View 2 Replies
View Related
Apr 21, 2014
I have been working a while with saving and retrieve structs, and I still have not got it to work. I get Segmentation fault sh "${SHFILE} . I have search this error, and it has something to do with memory, but what, since I am a beginner with saving and retrieving files. The project runs fine, and the error stated above outputs into my console window as text.
Here are my two structs:
struct checkbook {
char id[50];
double value[50];
};
struct fbook {
[Code] ....
Here is how I save and retrieve my structs:
void saveCheckbook (string file, checkbook checkbook, double initial, int counter) {
string path = "C:UsersAshwinGoogle DriveC++Checkbook" + file;
fbook save;
save.counter = counter;
save.initial = initial;
save.book = checkbook;
[Code] ...
View 1 Replies
View Related
Jul 11, 2014
i have a gataGidView that already has colomns inside, i want to know how i could possibly load data from a text file into it and then save data once the form is closing, im also having trouble with the separators ( winForm visual S...)
Ive already tried planning it but my way doesn't seem to work, heres my logic :
file load
if (file exists)
{
read file/load data
}
[Code]....
View 5 Replies
View Related
Jan 26, 2015
I started with C# 2 days ago, but i have made 3 "games". Its something like Cookie Clicker, very simple and very easy.
But I have problem with saving the game. I want to save values of variables to text file when i click on button, and when i click on another button i want to values of variables load. Just simple save system. How it works and so.
View 8 Replies
View Related
Apr 24, 2015
I'm very new to c and c++ and am currently working on a Caesar cipher that grabs encrypted text from a txt file and decrypts it onto a new txt file. My code builds fine in CodeBlocks and when I run it, there is a new txt file created but it stays blank.
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <cstdlib>
using namespace std ;
int main(int argc, char *argv[]){
[Code] ....
View 7 Replies
View Related
Feb 2, 2015
[size="5"][size="4"]
I am programming in C and am having some trouble finding the .txt file I saved after having run my program. It is likely a stupid error on my behalf. However, it is causing me quite a bit of grief at the moment. I attached my source code below
abgcchp27ex1.txt (2.01K)
I coded my structure within my header file(bookInfo.h) correct along with everything else. My dilemma is a matter of my file location and whether it actually saved.
/* This program takes the book info program from chapter 27 and writes the info to a file named bookinfo.txt. */
// First include the file with the structure definition
#include "bookInfo.h"
#include
#include
FILE * fptr;
[Code]....
View 3 Replies
View Related
Aug 13, 2013
I'm intrested in creating programs of games and such which learns while playing and saving the information for further use. For example a tic tac toe game where the program saves evry game it won or lost and creates a tree of some kind that store the information of the game and save it in a file when the program is being quit. The problem i'm having is how to save a tree in a file efficently.
View 2 Replies
View Related
Feb 11, 2013
Fix this code? the result is Garpish>>
<iostream>
#include<fstream>
using namespace std;
class Student {
public:
char name[10];
char address[10];
[Code] ....
View 6 Replies
View Related
Sep 15, 2012
I have written code that saves a matrix to a utf-8 file. This code works just fine when invoked from a win32 console app, but if I attempt to use the exact same code by invoking it within a SDI Doc/View Serialize(CArchive& ar), if(ar.IsStoring), it fails, but in a somewhat unusual manner. Namely, the file shows up in the designated directory, but it is an empty file (0 bytes), and the 'Unable to open file' message is seen in Debug config. Note that both the win32 console app and the SDI app are both using a Unicode character set, however, only the SDI app uses the method inside a Serialize(CArchive& ar) method, whereas the win32 console app evokes the save method directly from within _tmain. Why this seemingly illogical disparity occurs.
Here's the template code I have used in innumerable applications to save matrices to a disk file.
Code:
namespace TNT {
// saves a TNT double matrix, discriminating between real and complex matrices by virtue of the respective file markers, 'MATCALC94R' and 'MATCALC94C'.
template <class T>
void SaveRealBMatrix(const Matrix<T> &M, string sfilename) {
_RPT0(0, "SaveRealBMatrix:
");
_RPT1(0, "sfilename =: |%s|
[Code] ....
Here's the code from the SDI document Serialize(CArchive& ar) that fails as described above. Note that m_M is a class member TNT::Matrix<double> m_M that has been verified to exist in the Serialize method.
Code:
void CMyWndDoc::Serialize(CArchive& ar) {
if (ar.IsStoring()) {
CString csFileName = ar.m_strFileName;
wstring ws = csFileName.GetBuffer(0);
string s(ws.begin(), ws.end());
[Code] .....
View 2 Replies
View Related
Sep 24, 2012
I have MFC class that contains a CMap with 160K~ entries. CMap(long,long,long,long).
I need to save this CMap in oracle SQL.
How do you recommend to save it ?
View 1 Replies
View Related