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

DataAdapters/DataSets

Alright, as much as I've done CSharp, I've done very little with databases with it. So I'm just kind of messing around with,
learning how it works.
I am using the ADO.NET adapter provided with MySQL in a very simple web application.
I have the connection, data adapter, and typed datasets created. In response to a button submit, I perform the following:

accountsDataAdapter.Fill(accountsDS1);
Label_Accounts.Text = accountsDS1.accounts.Count.ToString();

The label gets set to 0 - even though there ARE accounts present in the table. In fact, if I instead do:
Label_Accounts.Text = accountsDataAdapter.Fill(accountsDS1).ToString();

I correctly return 46.

Its possible its a problem in the custom data provider, but I wanted to be sure I was using it correctly first :)

Thanks!
--
Adam Clauss
ca*****@tamu.edu

Nov 16 '05 #1
2 1331
"Adam Clauss" <ca*****@tamu.edu> wrote in message news:eZ*************@tk2msftngp13.phx.gbl...
Alright, as much as I've done CSharp, I've done very little with databases with it. So I'm just kind of messing around with,
learning how it works.
I am using the ADO.NET adapter provided with MySQL in a very simple web application.
I have the connection, data adapter, and typed datasets created. In response to a button submit, I perform the following:

accountsDataAdapter.Fill(accountsDS1);
Label_Accounts.Text = accountsDS1.accounts.Count.ToString();

The label gets set to 0 - even though there ARE accounts present in the table. In fact, if I instead do:
Label_Accounts.Text = accountsDataAdapter.Fill(accountsDS1).ToString();

I correctly return 46.

Its possible its a problem in the custom data provider, but I wanted to be sure I was using it correctly first :)


I'm a little confused by the syntax in the following lines:

accountsDataAdapter.Fill(accountsDS1);
Label_Accounts.Text = accountsDS1.accounts.Count.ToString();

Since a DataSet is a collection of DataTables, I have typically seen the Fill method used with two parameters, dataset comma tablename. For example:

accountsDataAdapter.Fill(accountsDS1, "Accounts"); // or whatever table is named

Also, what is the 'accounts' property of accountsDS1? Shouldn't that be as follows:

Label_Accounts.Text = accountsDS1.Tables["Accounts"].Rows.Count.ToString();

I don't know if these are actual syntax errors or a lack of understanding on my part.

- carl
Nov 16 '05 #2
I am not very use to with Typed Dataset Syntax, but I think accounts is your
Table, when you call ToString on DataAdapter's Fill method, it returns
number of rows in your table, try checking
accountsDS1.accounts.rows.count.tostring(). Pl. sorry abt the Typed DS
syntax, what I mean try to count the number of rows in Rows collection.

"Adam Clauss" <ca*****@tamu.edu> wrote in message
news:eZ*************@tk2msftngp13.phx.gbl...
Alright, as much as I've done CSharp, I've done very little with databases with it. So I'm just kind of messing around with, learning how it works.
I am using the ADO.NET adapter provided with MySQL in a very simple web application. I have the connection, data adapter, and typed datasets created. In response to a button submit, I perform the following:
accountsDataAdapter.Fill(accountsDS1);
Label_Accounts.Text = accountsDS1.accounts.Count.ToString();

The label gets set to 0 - even though there ARE accounts present in the table. In fact, if I instead do: Label_Accounts.Text = accountsDataAdapter.Fill(accountsDS1).ToString();

I correctly return 46.

Its possible its a problem in the custom data provider, but I wanted to be sure I was using it correctly first :)
Thanks!
--
Adam Clauss
ca*****@tamu.edu

Nov 16 '05 #3

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

Similar topics

0
by: hillscottc | last post by:
I have two DataAdapters....1)daStandard does a SELECT *, and 2)daDuplicates uses a stored proc which returns only rows with some duplicate data. Problem is, when I butRefresh_Click and I have...
4
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset...
2
by: Vik | last post by:
Is it possible to loop through all dataadapters on page? Thanks
4
by: Jon Maz | last post by:
Hi, I just read the following in an old NG thread: "when you use the adapter with a closed connection it will open it, do your requested database access, and close it immediately. If you use...
2
by: JJ | last post by:
Hi All, On my webform in ASP.net I have dragged 4 SqlDataAdapters and have dropped them to webform. I was wondering what is the norm for how many SqlDataAdapters should be used in a webform? Is...
2
by: JohnT | last post by:
Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file. I have two DataAdapters that I use to search for specific info. The two of them are similar except one is a Date, the...
9
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
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...
9
by: gardnern | last post by:
We have X number of data sets, of Y length each. For example... Small, Medium, Large and Red, Green, Blue, Yellow We need to generate a list of all possibilities Small Red
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 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...

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.