Hi guys,
I'm having a System.Data.OleDb.OleDbException error with C++/CLI language environment. I've created a form with a DataGridView to show the whole table from the database, it is allowed to modify the records from the DataGridView. Once a button is pressed it will start the code below - conn->Open();
-
-
//Get changed rows if existed
-
dsChange = dsFac->GetChanges(DataRowState::Modified);
-
dsAdd = dsFac->GetChanges(DataRowState::Added);
-
dsDelete = dsFac->GetChanges(DataRowState::Deleted);
-
-
da = daFac;
-
strTable = "Facility";
-
-
if(dsChange)
-
{
-
strSQL = "UPDATE Facility "
-
"SET FName = @FName, FDescription = @FDescription "
-
"WHERE FID = @FID";
-
cmd = gcnew OleDbCommand(strSQL,conn);
-
cmd->Parameters->Add("@FID", OleDbType::Char, 5, "FID");
-
cmd->Parameters->Add("@FName", OleDbType::VarChar, 15, "FName");
-
cmd->Parameters->Add("@FDescription", OleDbType::VarChar, 40, "FDescription");
-
da->UpdateCommand = cmd;
-
da->Update(dsChange, strTable);
-
}
-
if(dsAdd)
-
{
-
strSQL = "INSERT INTO Facility (FID, FName, FDescription) "
-
"VALUES (@FID, @FName, @FDescription)";
-
cmd = gcnew OleDbCommand(strSQL,conn);
-
cmd->Parameters->Add("@FID", OleDbType::Char, 5, "FID");
-
cmd->Parameters->Add("@FName", OleDbType::VarChar, 15, "FName");
-
cmd->Parameters->Add("@FDescription", OleDbType::VarChar, 40, "FDescription");
-
da->InsertCommand = cmd;
-
da->Update(dsAdd, strTable);
-
}
-
if(dsDelete)
-
{
-
strSQL = "DELETE FROM Facility WHERE FID = @FID";
-
cmd = gcnew OleDbCommand(strSQL,conn);
-
cmd->Parameters->Add("@FID", OleDbType::Char, 5, "FID");
-
da->DeleteCommand = cmd;
-
da->Update(dsDelete, strTable);
-
}
The code above will detect the Modified, Added, Deleted actions made from the user. For example I'm updating one of the FDescription field in the records, pressed the button and it shows an error pointing to this line. - da->Update(dsChange, strTable);
Where the error message is: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: No value given for one or more required parameter
This is the stack captured for the error.. - System.Data.dll!System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(System.Data.Common.RowUpdatedEventArgs rowUpdatedEvent, System.Data.Common.DbDataAdapter.BatchCommandInfo[] batchCommands, int commandCount) + 0x18b bytes
-
System.Data.dll!System.Data.Common.DbDataAdapter.UpdatedRowStatus(System.Data.Common.RowUpdatedEventArgs rowUpdatedEvent, System.Data.Common.DbDataAdapter.BatchCommandInfo[] batchCommands, int commandCount) + 0x2e bytes
-
System.Data.dll!System.Data.Common.DbDataAdapter.Update(System.Data.DataRow[] dataRows, System.Data.Common.DataTableMapping tableMapping) + 0x7d2 bytes
-
System.Data.dll!System.Data.Common.DbDataAdapter.UpdateFromDataTable(System.Data.DataTable dataTable, System.Data.Common.DataTableMapping tableMapping) + 0x2a bytes
-
System.Data.dll!System.Data.Common.DbDataAdapter.Update(System.Data.DataSet dataSet, string srcTable) + 0xb1 bytes
-
> WWZ_Admin.exe!WWZ_Admin::WWZ_DB::btnUpdate_Click(System::Object^ sender, System::EventArgs^ e) Line 372 + 0x11 bytes C++
-
Can anyone tell me what am I missing on the dataset settings? or is it an error in another part? Any help is greatly appreciated.
0 1228 Sign in to post your reply or Sign up for a free account.
Similar topics
by: G.Esmeijer |
last post by:
Friends,
The following code works fin. BUT...
after a >> couple times<< this code is used is a class it comes with an
error saying
unhandled System.Data.OleDb.OleDbException' occurred in...
|
by: Alex |
last post by:
Hi,
is it possible to determine exactly what type of error/exception was thrown
from a try catch block bt simple catching the generic error.
by this I mean, suppose I have the follwoing code...
|
by: T8 |
last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by...
|
by: GotdotNet |
last post by:
I get this error once in a while and I normally could fix it by restarting IIS. However, I would like to find out what causes this. Can anyone help?
-----------------------------error...
|
by: Jim McGivney |
last post by:
ASPX page from VS.net-C# on host's computer using oleDataAdaptor to connect
to Microsoft Access database.
The page loads, but when connection to the database is attempted to fill a
datagrid the...
|
by: petro |
last post by:
Hello all,
My asp.net web application works on my machine but I get the following error
on our test web server, There is only one oracle home on the test server.
Does anyone know how to resolve...
|
by: Darrell |
last post by:
Hello,
I have the following SQL statement in an OleDbDataAdapter:
SELECT Customers.Watch, Format(FinStmts., 'MM/DD/YY') AS ExpDate, Customers.FullName, Customers.Phone1, Customers.SSN, ...
|
by: mkahn |
last post by:
Fater leaving my computer for a few minutes. I tried to continue working with the page am on. Seems to be that after my connection timed out, am not able to reconnect to the data base getting the...
|
by: vatrix |
last post by:
I get an error meessage and a crash on my OleDbDataAdapter from the following code trying to call up record meeting a simple date criteria. What am I doing wrong. Been on this problem for a week now....
|
by: rn5a |
last post by:
When a user finally confirms his order in a shopping cart application
(using MS-Access as the backend), the items he has purchased are
populated in a Access DB table named *Orders* & his personal...
|
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,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |