After successfully creating a connection to an Access Database file on
my computer, I try to add a new row. Everything seems to go fine, but
when I open the file in Access, the row isn't there. I get no errors
or exceptions while running. In the code below, you can see I go back
and check if the data is in the table after I've added it, and it is.
Still, it's never stored permanently. Obviousy, I'm missing some
steps. Can anyone point me in the right direction?
m_dbConnection = gcnew OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .
4.0;" +
"DataSource =" + szDataPath);
/* returns an empty dataset but with the correct structure */
sa->Fill( ds, "serial" );
DataTable ^m_pTable = ds->Tables["serial"];
DataRow ^pNewRow = m_pTable->NewRow();
pNewRow["SerialNum"] = szSerial;
m_pTable->Rows->Add( pNewRow );
pNewRow->AcceptChanges( );
sa->Update( ds, "serial" );
array<DataRow ^^aRow = ds->Tables["serial"]->Select();
int i;
for( i=0; i<aRow->Length; ++i )
{
/* SHOWS THE VALUE I ADDED! */
MessageBox::Sho w( Convert::ToStri ng( aRow[i]["SerialNum"] ) );
}
m_dbConnection->Close();
Thanks in advance,
T 1 1029
Here's what I ended up doing to make it work, should anyone have a
similar problem:
/*
* INSERT (OR DO ANYTHING) USING SQL COMMANDS
*/
String ^insertSQL = gcnew String("INSERT INTO serial (SerialNum)
VALUES( '" + szSerial + "' );");
OleDbCommand ^command = gcnew OleDbCommand(in sertSQL);
command->Connection = m_dbConnection;
m_dbConnection->Open();
command->ExecuteNonQuer y();
m_dbConnection->Close(); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ger |
last post by:
Hi all. Atm i am writing special system to store and restore
information. There were diffirent ideas how to do this, all have
pluses and minuses. Finally we desided to write system, what is
creating stored procedures and function by inputed architecture. Now i
have dilemma.
I need to store code on oracle from inside oracle package. Any ideas
how can i do this, exect using EXECUTE IMMEDIATE with whole
procedure-function-package? Any...
|
by: Sami |
last post by:
Please bear with me, and if you answer this question, please do it
step by step. I am new at Access, not at all sophisticated. I am
using Office XP. This will need to be read in Access for Office 2000.
I am creating a database to track student athletes. I have created
the following tables. The table title is to the far left, with fields
under each. The common field will be the StudentID field, which is
their student number assigned...
|
by: Alex |
last post by:
Acc 97
Hi, I am in need of some help here....
I have a query which is based upon time, where i need to plot the
hours
a job has been working.. therefore, oN & off in a union query.
problem...
|
by: Janet Chapman |
last post by:
I am creating a database for a video shop and in the loans table want
there to be a field for date taken, with a default value of today.
Trying to write =today() as in the help gives an error, while using
=date() adds todays date, but this changes as the date changes.
Please help.
Janet Chapman
|
by: Tim Marsden |
last post by:
Hi,
This is what I am doing, please comment if this is the correct way.
I need to add controls to a form dynamically.
Within the Page_Load event (is not Postback) I run a routine to create the
controls, and populate the dropdowns etc,
I use addhandler to define delegates to capture events raised by the
controls.
I store these controls in a hashtable.
| |
by: Ian Boyd |
last post by:
Every time during development we had to make table changes, we use Control
Center. Most of the time, Control Center fails. If you try to "undo all", it
doesn't, and you end up losing your identity seed, or your constraints, or
your triggers, or your table. Talking to developers at other companies who
have had the misfortune of using DB2, they are adamant that you cannot use
the tools; they are buggy and you just have to resign yourself to...
|
by: Dinsdale |
last post by:
I'm looking at adding scheduling features to an application and I
wanted to ask the community about any experience with scheduling
components, either open source like from code project or from a vendor.
I'd like to be able to create schedules and lock resources for things
like collision detection (two events trying to use the same resource).
I've seen some GANTT charting components but I don't think that's what
I'm looking for. I'd...
|
by: Ken Fine |
last post by:
I want to add the security question and answer security feature to the
ChangePassword control. I am aware that this functionality is built into the
PasswordRecovery tool. I have implemented the PasswordRecovery with a
Password reset required; a temporary password is sent to the account on
file. I want an extra layer of security to accommodate the very unlikely
contingency that someone's e-mail account is compromised. Challenging with
the...
|
by: jehugaleahsa |
last post by:
Hello:
We wrote an entire application where we add our DataRows to our
DataTables immediately. However, we have to shut off our constraints
to do this. We would like to use detached DataRows to circumvent this.
What do you normally do to track detached DataRows? Is there a way to
retrieve them? or do I have to stored them in some temporary location?
Thanks for any input!
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |