473,407 Members | 2,320 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,407 software developers and data experts.

help with datasets, datatables, etc

I have a C# database app (someone else's code) that started crashing
when I changed some values in a data table. If I use numeric data in
this field, it works OK. Changing to non-numeric strings causes Oracle's
ORA-01722 error (invalid number). I know what is wrong, but I don't know
how to fix the application to allow non-numeric data. The table data is
VARCHAR2.

This is a snippet from the code that crashes:
CCNUMBER is the column that I added some non-numeric data into.

string cmd = "SELECT NONINCREMENTING FROM PXCCDB WHERE CCNUMBER = " +
cboProxCC.SelectedItem.ToString().Trim() + " ORDER BY CCNUMBER";

OleDbDataAdapter da = new OleDbDataAdapter(cmd, cnCPS); // cnCPS is the
connection

DataSet ds = new DataSet();

try
{
da.Fill(ds, "ProxCC"); // throws exception here
}

What is "ProxCC"? I can't find any references to that name in the
application. And how does the text data from the database get assigned
to a number? That's the part I can't figure out.
Nov 16 '05 #1
2 1612
Hi,
inline

"Dave Cullen" <no*****@mail.com> wrote in message
news:40***************@mail.com...
I have a C# database app (someone else's code) that started crashing
when I changed some values in a data table. If I use numeric data in
this field, it works OK. Changing to non-numeric strings causes Oracle's
ORA-01722 error (invalid number). I know what is wrong, but I don't know
how to fix the application to allow non-numeric data. The table data is
VARCHAR2.

This is a snippet from the code that crashes:
CCNUMBER is the column that I added some non-numeric data into.

string cmd = "SELECT NONINCREMENTING FROM PXCCDB WHERE CCNUMBER = " +
cboProxCC.SelectedItem.ToString().Trim() + " ORDER BY CCNUMBER";
Try :
string cmd = "SELECT NONINCREMENTING FROM PXCCDB WHERE + CNUMBER = '" +
cboProxCC.SelectedItem.ToString().Trim() + "' ORDER BY CCNUMBER";

There should be a single quote before and after the string value.

OleDbDataAdapter da = new OleDbDataAdapter(cmd, cnCPS); // cnCPS is the
connection

DataSet ds = new DataSet();

try
{
da.Fill(ds, "ProxCC"); // throws exception here
}

What is "ProxCC"? I can't find any references to that name in the
The result of the query is stored in a table called ProxCC (instead of
PXCCDB) inside the dataset, you can later refer to it as da["ProxCC"] or
da[0] .
application. And how does the text data from the database get assigned
to a number? That's the part I can't figure out.


hth,
greetings
Nov 16 '05 #2
You have a sharp eye :-) Thanks very much.

drc
BMermuys wrote:

Hi,
inline

"Dave Cullen" <no*****@mail.com> wrote in message
news:40***************@mail.com...
I have a C# database app (someone else's code) that started crashing
when I changed some values in a data table. If I use numeric data in
this field, it works OK. Changing to non-numeric strings causes Oracle's
ORA-01722 error (invalid number). I know what is wrong, but I don't know
how to fix the application to allow non-numeric data. The table data is
VARCHAR2.

This is a snippet from the code that crashes:
CCNUMBER is the column that I added some non-numeric data into.

string cmd = "SELECT NONINCREMENTING FROM PXCCDB WHERE CCNUMBER = " +
cboProxCC.SelectedItem.ToString().Trim() + " ORDER BY CCNUMBER";


Try :
string cmd = "SELECT NONINCREMENTING FROM PXCCDB WHERE + CNUMBER = '" +
cboProxCC.SelectedItem.ToString().Trim() + "' ORDER BY CCNUMBER";

There should be a single quote before and after the string value.

OleDbDataAdapter da = new OleDbDataAdapter(cmd, cnCPS); // cnCPS is the
connection

DataSet ds = new DataSet();

try
{
da.Fill(ds, "ProxCC"); // throws exception here
}

What is "ProxCC"? I can't find any references to that name in the


The result of the query is stored in a table called ProxCC (instead of
PXCCDB) inside the dataset, you can later refer to it as da["ProxCC"] or
da[0] .
application. And how does the text data from the database get assigned
to a number? That's the part I can't figure out.


hth,
greetings

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: cody | last post by:
I've seen an Introduction on ADO.NET with its Datasets on .NET TV and Iam now wondering how it is realized/used in real world applications. I don't believe that one would create a dataset and add...
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
11
by: Peter M. | last post by:
Hi all, I'm currently designing an n-tier application and have some doubts about my design. I have created a Data Access layer which connects to the database (SQL Server) and performs Select,...
3
by: cj | last post by:
I've used datatables and datasets before. Datasets being able to hold more than one table and datatables being only one table. My mind keeps coming up with recordsets. I can't remember how they...
16
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
by: S Chapman | last post by:
Is there any tool that generates Typed DataTables rather than Typed Datasets? The trouble we are having is we have quite a few tables in our database and a single table can be a part of more than...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
0
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
1
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

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.