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

Tables[0].Select Issues

I have just put together a quick piece of code to update the local dataset
data, but it doesn't work. I think my understanding of Tables[0].Select is
incorrect. So what im asking is why doesn't this wokr and what would be a
good method to achieve an update of a dataset ?

public static bool UpdateLocal(double DisplayQuantity, string DisplayWeight,
double Cost, string Status)

{

DataRow[] Purchases;

double dblQuantityRequired = 0;

bool blnSucess = false;

try

{

Purchases =
m_dsPurchaseOrderDetails.Tables[0].Select("PurchaseOrderDetailsID = " +
m_PurchaseOrderDetailsID);

if (Purchases.Length 0)

{

dblQuantityRequired =
ConvertIntoTheLowestUnit(DisplayWeight,DisplayQuan tity);
Purchases[0]["QuantityRequired"] = dblQuantityRequired;

Purchases[0]["DisplayQuantity"] = DisplayQuantity;

Purchases[0]["DisplayWeight"] = DisplayWeight;

Purchases[0]["PurchaseStatus"] = Status;

blnSucess = true;

}

}

catch

{

blnSucess = false;

}

return blnSucess;

}
Aug 1 '06 #1
3 5256
Ignore this. Turns out someone had a refresh from the dataset call in the
display function.

"Jon Vaughan" <jo**********@hotmail.comwrote in message
news:Ib*********************@fe09.news.easynews.co m...
>I have just put together a quick piece of code to update the local dataset
data, but it doesn't work. I think my understanding of Tables[0].Select is
incorrect. So what im asking is why doesn't this wokr and what would be a
good method to achieve an update of a dataset ?

public static bool UpdateLocal(double DisplayQuantity, string
DisplayWeight, double Cost, string Status)

{

DataRow[] Purchases;

double dblQuantityRequired = 0;

bool blnSucess = false;

try

{

Purchases =
m_dsPurchaseOrderDetails.Tables[0].Select("PurchaseOrderDetailsID = " +
m_PurchaseOrderDetailsID);

if (Purchases.Length 0)

{

dblQuantityRequired =
ConvertIntoTheLowestUnit(DisplayWeight,DisplayQuan tity);
Purchases[0]["QuantityRequired"] = dblQuantityRequired;

Purchases[0]["DisplayQuantity"] = DisplayQuantity;

Purchases[0]["DisplayWeight"] = DisplayWeight;

Purchases[0]["PurchaseStatus"] = Status;

blnSucess = true;

}

}

catch

{

blnSucess = false;

}

return blnSucess;

}


Aug 1 '06 #2
Make sure that PurchaseOrderDetailsID is a table primary key while you
use select method on the table ?

Additionally, you can also use DataSet.GetChanges method to return
dataset containing all data that should update.

Sincerely,
simida

Jon Vaughan 写道:
Ignore this. Turns out someone had a refresh from the dataset call in the
display function.

"Jon Vaughan" <jo**********@hotmail.comwrote in message
news:Ib*********************@fe09.news.easynews.co m...
I have just put together a quick piece of code to update the local dataset
data, but it doesn't work. I think my understanding of Tables[0].Select is
incorrect. So what im asking is why doesn't this wokr and what would be a
good method to achieve an update of a dataset ?

public static bool UpdateLocal(double DisplayQuantity, string
DisplayWeight, double Cost, string Status)

{

DataRow[] Purchases;

double dblQuantityRequired = 0;

bool blnSucess = false;

try

{

Purchases =
m_dsPurchaseOrderDetails.Tables[0].Select("PurchaseOrderDetailsID = "+
m_PurchaseOrderDetailsID);

if (Purchases.Length 0)

{

dblQuantityRequired =
ConvertIntoTheLowestUnit(DisplayWeight,DisplayQuan tity);
Purchases[0]["QuantityRequired"] = dblQuantityRequired;

Purchases[0]["DisplayQuantity"] = DisplayQuantity;

Purchases[0]["DisplayWeight"] = DisplayWeight;

Purchases[0]["PurchaseStatus"] = Status;

blnSucess = true;

}

}

catch

{

blnSucess = false;

}

return blnSucess;

}
Aug 1 '06 #3
"GetChanges", Ineteresting as I always used a select with the rows that have
changed as a filter.

"Jon Vaughan" <jo**********@hotmail.comwrote in message
news:Ib*********************@fe09.news.easynews.co m...
>I have just put together a quick piece of code to update the local dataset
data, but it doesn't work. I think my understanding of Tables[0].Select is
incorrect. So what im asking is why doesn't this wokr and what would be a
good method to achieve an update of a dataset ?

public static bool UpdateLocal(double DisplayQuantity, string
DisplayWeight, double Cost, string Status)

{

DataRow[] Purchases;

double dblQuantityRequired = 0;

bool blnSucess = false;

try

{

Purchases =
m_dsPurchaseOrderDetails.Tables[0].Select("PurchaseOrderDetailsID = " +
m_PurchaseOrderDetailsID);

if (Purchases.Length 0)

{

dblQuantityRequired =
ConvertIntoTheLowestUnit(DisplayWeight,DisplayQuan tity);
Purchases[0]["QuantityRequired"] = dblQuantityRequired;

Purchases[0]["DisplayQuantity"] = DisplayQuantity;

Purchases[0]["DisplayWeight"] = DisplayWeight;

Purchases[0]["PurchaseStatus"] = Status;

blnSucess = true;

}

}

catch

{

blnSucess = false;

}

return blnSucess;

}


Aug 1 '06 #4

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

Similar topics

3
by: phatnugs420 | last post by:
Hi all... I'm trying write a function to export certain information from a database that has related information in different tables. I can extract the info fine it's just getting it to match up...
10
by: Albretch | last post by:
.. Can you define the Character Set for particular tables instead of databases? . Which DBMSs would let you do that? . How do you store in a DBMS i18n'ed users' from input, coming over the web...
2
by: David | last post by:
Hi, We have an internal network of 3 users. Myself & one other currently have individual copies of the front-end MS Access forms and via our individual ODBC links we have used the: File > Get...
6
by: Don Leverton | last post by:
Hi All, I've got a situation where I am developing an Access 97 app for a client, and am in the "beta testing" stage. I have split the app up, using the DB splitter, into front-end /back-end...
0
by: drjmwebb | last post by:
I am using Access 2000/Windows 2000 on a Novel network I have a multi-user program that tracks documents and their holders. There are three primary tables tblHolders, tblDocuments and a link...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
10
by: Richard Maher | last post by:
Hi, Sorry if this is one of those issues that people feel passionate about and I assure you I'm not trolling but rather seeking guidance on which way to go with the web browser presentation of...
3
by: Henrootje | last post by:
I have a lot of tables that hold a lot of numeric fields. The names of all of these tables start with ' tblRO' Now it turns out that all of the numeric fields with type double precision have the...
1
thewesties
by: thewesties | last post by:
Could somebody please help me before I dump a gallon of water on my pc! I am very happy to have come across this site on the internet. TheScripts has helped me through so many issues to this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.