Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 1st, 2005, 02:01 PM
rafaeazhar rafaeazhar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 7 rafaeazhar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 30 sec
Reputation Power: 0
Accessing a particular datafield from a dataset

I wanted to access a particular datafield from the dataset i recieve as a result of executing a stored procedure on SQL server. I tried using dataset.tables().rows(), but cant figure out how exactly to work with it.
How can i access a datafield without using XML ( some solutions which i read earlier had read data from a field using XML )

Reply With Quote
  #2  
Old November 2nd, 2005, 09:01 PM
blicci's Avatar
blicci blicci is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Philly
Posts: 351 blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 22 h 8 m 5 sec
Reputation Power: 52
You are on the right track
dataset.tables(table_index_or_name).rows(index).it em(item_index_or_name)
the indicies can either be intergers or fully qualified names, the row will be an interger
like
dataset.tables("table_name").rows(0).item("column_name")

Reply With Quote
  #3  
Old November 7th, 2005, 06:32 AM
rafaeazhar rafaeazhar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 7 rafaeazhar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 30 sec
Reputation Power: 0
i used this code 'textbox1.text = order.Tables("orders").Rows(0).Item("orderId")' where 'order' is the dataset and 'orders' is the table and the column i want to access is the 'orderId'. It shows an error "Object reference not set to an instance of an object", though the table is poplulated.

Reply With Quote
  #4  
Old November 9th, 2005, 01:45 PM
blicci's Avatar
blicci blicci is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Philly
Posts: 351 blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 22 h 8 m 5 sec
Reputation Power: 52
Please post your code.
Quote:
Originally Posted by rafaeazhar
i used this code 'textbox1.text = order.Tables("orders").Rows(0).Item("orderId")' where 'order' is the dataset and 'orders' is the table and the column i want to access is the 'orderId'. It shows an error "Object reference not set to an instance of an object", though the table is poplulated.

Reply With Quote
  #5  
Old November 12th, 2005, 07:17 PM
rafaeazhar rafaeazhar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 7 rafaeazhar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 30 sec
Reputation Power: 0
I found out the problem. Actually, instead of the 'tablename' in tables i had to type '0'. dataset.tables(0).row(0).item("itemName") works fine.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Accessing a particular datafield from a dataset


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT