I'm having some trouble with the DataAdapter in my code. When the parameter
in an OleDbCommand, which is created
as having a type of OleDbType.Decim al, is set to System.DbNull, the actual
value posted to the database upon execution of the Insert command is a
floating point value of zero (0.0, actually).
The DataAdapter is associated with a DataGrid. When a row is inserted into
the grid, the column may contain either nothing "(null)"
or a floating point value.
Here's some excerpts from the code that may help someone help me with this:
DAdapter = New OleDbDataAdapte r
'Build insert command
CommandText = "Insert into db.threshold threshd_critica l) values (?)"
DAdapter.Insert Command = New OleDbCommand(Co mmandText, mConnection)
'Define parameters for insert command
workParam = DAdapter.Insert Command.Paramet ers.Add("thresh d_critical",
OleDbType.Decim al)
workParam.Sourc eColumn = "threshd_critic al"
workParam.Sourc eVersion = DataRowVersion. Current
Any assistance would be greatly appreciated!
Tom 3 1722
Hi Tom,
Several issues can exhibit this symptom. Would you please let me know what
database you're using (I'm assuming it's Microsoft Access, since you're
using OleDb), and we can narrow down the issue. This may not be an issue
with the DataAdapter (I assume you've tested this with a straight SQL
statement in your database's UI?).
HTH,
Derrick
"Tom Luetz II" <tl****@comcast .net> wrote in message
news:qP******** ************@co mcast.com... I'm having some trouble with the DataAdapter in my code. When the
parameter in an OleDbCommand, which is created as having a type of OleDbType.Decim al, is set to System.DbNull, the actual value posted to the database upon execution of the Insert command is a floating point value of zero (0.0, actually).
The DataAdapter is associated with a DataGrid. When a row is inserted into the grid, the column may contain either nothing "(null)" or a floating point value.
Here's some excerpts from the code that may help someone help me with
this: DAdapter = New OleDbDataAdapte r
'Build insert command CommandText = "Insert into db.threshold threshd_critica l) values (?)" DAdapter.Insert Command = New OleDbCommand(Co mmandText, mConnection)
'Define parameters for insert command workParam = DAdapter.Insert Command.Paramet ers.Add("thresh d_critical", OleDbType.Decim al) workParam.Sourc eColumn = "threshd_critic al" workParam.Sourc eVersion = DataRowVersion. Current
Any assistance would be greatly appreciated!
Tom
The database being used is IBM UDB DB2 v7.2.
If you execute the SQL manually, the proper value is inserted into the
database.
I should have mentioned that my code worked just fine when the
InsertCommand's
parameter was defined as OleDbType.Integ er; only when it was changed to
Decimal
did I start to have the aforementioned problem.
Thanks,
Tom
"Derrick [MCSD]" <Derrick[underscore]Repep[at]toxicall[dot]com> wrote in
message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. Hi Tom,
Several issues can exhibit this symptom. Would you please let me know
what database you're using (I'm assuming it's Microsoft Access, since you're using OleDb), and we can narrow down the issue. This may not be an issue with the DataAdapter (I assume you've tested this with a straight SQL statement in your database's UI?).
HTH, Derrick
"Tom Luetz II" <tl****@comcast .net> wrote in message news:qP******** ************@co mcast.com... I'm having some trouble with the DataAdapter in my code. When the parameter in an OleDbCommand, which is created as having a type of OleDbType.Decim al, is set to System.DbNull, the
actual value posted to the database upon execution of the Insert command is a floating point value of zero (0.0, actually).
The DataAdapter is associated with a DataGrid. When a row is inserted
into the grid, the column may contain either nothing "(null)" or a floating point value.
Here's some excerpts from the code that may help someone help me with this: DAdapter = New OleDbDataAdapte r
'Build insert command CommandText = "Insert into db.threshold threshd_critica l) values (?)" DAdapter.Insert Command = New OleDbCommand(Co mmandText, mConnection)
'Define parameters for insert command workParam = DAdapter.Insert Command.Paramet ers.Add("thresh d_critical", OleDbType.Decim al) workParam.Sourc eColumn = "threshd_critic al" workParam.Sourc eVersion = DataRowVersion. Current
Any assistance would be greatly appreciated!
Tom
The database being used is IBM UDB DB2 v7.2.
If you execute the SQL manually, the proper value is inserted into the
database.
I should have mentioned that my code worked just fine when the
InsertCommand's
parameter was defined as OleDbType.Integ er; only when it was changed to
Decimal
did I start to have the aforementioned problem.
Thanks,
Tom "Derrick [MCSD]" <Derrick[underscore]Repep[at]toxicall[dot]com> wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. Hi Tom,
Several issues can exhibit this symptom. Would you please let me know what database you're using (I'm assuming it's Microsoft Access, since you're using OleDb), and we can narrow down the issue. This may not be an
issue with the DataAdapter (I assume you've tested this with a straight SQL statement in your database's UI?).
HTH, Derrick
"Tom Luetz II" <tl****@comcast .net> wrote in message news:qP******** ************@co mcast.com... I'm having some trouble with the DataAdapter in my code. When the parameter in an OleDbCommand, which is created as having a type of OleDbType.Decim al, is set to System.DbNull, the actual value posted to the database upon execution of the Insert command is a floating point value of zero (0.0, actually).
The DataAdapter is associated with a DataGrid. When a row is inserted into the grid, the column may contain either nothing "(null)" or a floating point value.
Here's some excerpts from the code that may help someone help me with
this: DAdapter = New OleDbDataAdapte r
'Build insert command CommandText = "Insert into db.threshold threshd_critica l) values (?)" DAdapter.Insert Command = New OleDbCommand(Co mmandText, mConnection)
'Define parameters for insert command workParam = DAdapter.Insert Command.Paramet ers.Add("thresh d_critical", OleDbType.Decim al) workParam.Sourc eColumn = "threshd_critic al" workParam.Sourc eVersion = DataRowVersion. Current
Any assistance would be greatly appreciated!
Tom
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hch |
last post by:
dataAdapter.Update(data, "TableName") won’t work!
I was about to deploy my first website on the Internet only to discover that
the dataAdapter.Update() throws the Server Error in the third underline. It
was working fine before.
ConnectionString in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
|
by: Pavils Jurjans |
last post by:
Hello,
I am building custom hashtable class, and thinking about value retrieval
issues. The thing is, that sometimes the hashtable value may contain value
null. If someone is reading this value like this
value = myHashtable;
then, is the value of "myKey" key is null, then the result is the same, as
|
by: Clint |
last post by:
Hey all -
I'm having a really confusing problem concerning a web service. Right
now, I have an application that needs to call a web service that does
nothing but return "true" (this will obviously change once the
program's fully built to actually do something, but for testing, it
works).
The only code I added to the service is below:
|
by: Dica |
last post by:
i'm getting an error when trying set my dataAdapter's selectCommand. the
sqlStatement is a storedProc which takes parameters, so it's constructed as:
sqlSelectCommand1.CommandText = "";
sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure;
sqlSelectCommand1.Connection = sqlConnection1;
sqlSelectCommand1.Parameters.Add(new
|
by: Dean Slindee |
last post by:
I am looking for the "right" way to handle inserting and presenting null
date values.
Public Const c_NullDate As Date = #12:00:00 AM#
If I set the value of a date variable in an SQL Server insert statement to
c_NullDate, the insert statement works. When I re-read the row and display
the inserted date value in a text box, the string "1/1/1900" is displayed.
If one wanted the textbox to display an empty string, how should either the
insert...
| |
by: George |
last post by:
Got a question about the side effect of DataAdapter.Update() and
DataTable.GetChanges().
Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove)
a row in the data table and call the following method.
public void JobListDataTableFromAccessCommitChange()
{
System.Data.DataTable oChangeDataTable;
|
by: George |
last post by:
I have set DataAdapter.AcceptChangesDuringUpdate = true;
However, I find that I still need to call AcceptChanges on the associated
DataTable,
DataTable.AcceptChanges();
Has anyone encountered that? Am I not setting this field properly?
The following are some of the snippets of the codes which may help explain
|
by: Keith G Hicks |
last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher"
project. Starting and stopping the watcher and reading my XML file work
fine. Once the watcher is started, I'm reading the text files from the
watched folder line by line into variables and then posting them to a SQL
table.
All of the code for the form is shown below. And it works fine except for 2
issues.
First issue: In the Finally of the Try for teh SQL...
|
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: 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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |