473,387 Members | 1,745 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,387 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 1611
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
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...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
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,...
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.