473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Insert integer data

I am trying to insert integer values to mysql database using the integer variable declared in C++ language, but it is not inserting . it is inserting zeroes , but not the values in the variable. Can any one please tell me how to do it, It is very very urgent
code snippet is given below.

p is declared as integer

Expand|Select|Wrap|Line Numbers
  1.  void BarCode::OnBtnApplyClicked()
  2. {
  3.  
  4.  
  5.         int p = expDateSpin_btnStart.get_value_as_int();
  6.         Glib::ustring  s="ExpiredDate";
  7.         flag=true;
  8.         for(int i=0;i<num_rows;i++)
  9.         {
  10.                 dbase_obj.fetch_row();
  11.                 if(dbase_obj.row[1] == entry1.get_text())
  12.                 {
  13.                      flag=false;
  14.                      break;
  15.                 }
  16.                 else
  17.  
  18.                   flag=true;
  19.  
  20.         }
  21.         if(flag)
  22.  
  23.  
  24.         dbase_obj.get_connection(" INSERT into tblBarcodeRuleItem(CatNo,FieldName,Start)values ('"+entry3.get_text()+"','"+s+"', '"+p+"') " );
  25.  
  26. }
Jul 2 '07 #1
2 2773
r035198x
13,262 8TB
I am trying to insert integer values to mysql database using the integer variable declared in C++ language, but it is not inserting . it is inserting zeroes , but not the values in the variable. Can any one please tell me how to do it, It is very very urgent
code snippet is given below.

p is declared as integer

Expand|Select|Wrap|Line Numbers
  1.  void BarCode::OnBtnApplyClicked()
  2. {
  3.  
  4.  
  5.         int p = expDateSpin_btnStart.get_value_as_int();
  6.         Glib::ustring  s="ExpiredDate";
  7.         flag=true;
  8.         for(int i=0;i<num_rows;i++)
  9.         {
  10.                 dbase_obj.fetch_row();
  11.                 if(dbase_obj.row[1] == entry1.get_text())
  12.                 {
  13.                      flag=false;
  14.                      break;
  15.                 }
  16.                 else
  17.  
  18.                   flag=true;
  19.  
  20.         }
  21.         if(flag)
  22.  
  23.  
  24.         dbase_obj.get_connection(" INSERT into tblBarcodeRuleItem(CatNo,FieldName,Start)values ('"+entry3.get_text()+"','"+s+"', '"+p+"') " );
  25.  
  26. }
Is the p value correct? Have you tried printing it with a simple cout or something similar?
Jul 2 '07 #2
Yes p contains and prints whatever that is entered in the text box
Jul 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Martin | last post by:
Hello, I'm new with triggers and I can not find any good example on how to do the following: I have two tables WO and PM with the following fields: WO.WONUM, VARCHAR(10) WO.PMNUM,...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: maltchev | last post by:
i need to insert data from an xml file into sql server table. the xml file contains only one record. how to insert the data? how to map the names of the fields in the xml file and the table?...
9
by: collincm | last post by:
Hi, I am trying to optimize a table for inserts. Half of the timeron cost is in the FK lookup! These tables for example CREATE TABLE FOO2( FOO2_ID INTEGER NOT NULL CONSTRAINT FOO2_PK...
1
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
2
by: Rich | last post by:
Hello, I have an oleDBDataAdapter (da1) which gets data from an Access mdb and fills a dataset (ds1) with integer data from "tbl1" in Access. Data displays in textboxes on a form. The...
2
by: TheRomance | last post by:
i have a problem about insert integer to link list. sorry it's too long but i try many times, many ways , it's still have an error function is fix . can't change anything about function. i...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
6
by: TheRealDan | last post by:
Hi all. I'm having a problem with a special characters. I have php script that reads from an xml file and writes to a mysql db. It's a script called phptunest that I found on the net, although the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.