473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error passing dataset by ref

I am trying to pass a data object (set or row) into a functionbyref, and have the same issue either way. In the maincontroller function, I have no issues accessing any parts of mydataset. If I extract a data row, it has values and is fine. However, when I pass either the whole dataset or just a data rowto another function, it errors out, and in the Locals windowjust has "error: cannot obtain value" against every field. I'vecopied the code from another class where it works perfectly, cananyone suggest why it all of a sudden won't let me pass thedataset or components of the dataset successfully? Also, oncethis problem occurs, .NET won't let me set the next statementeither.

thanks for your help.

Sample code:

public sub controller()
<get the data here>

'this line works fine
dim intID as integer = objDataSet.Company(0).IDCompany

'now pass the dataset to the function
MapCompany(objDataSet) 'at this point dataset can beaccessed completely
end sub

private sub MapCompany(ByRef objDataset as CompanyDataset) asCompany
'at this point the data cannot be read any more
dim intID as integer = objDataset.Company(0).IDCompany
end sub

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>6B+eMxq2P0eSRkcNnoWQug==</Id>
Nov 20 '05 #1
1 1551
Add a try-catch block to see what the error is...

private sub MapCompany(ByRef objDataset as CompanyDataset) ' as Company <--
sub can't have return values
'at this point the data cannot be read any more
try
dim intID as integer = objDataset.Company(0).IDCompany
catch ex as exception
msgbox(ex.tostring)
debug.writeline(ex.tostring)
end try
end sub

Let us know exactly what the exception is you are getting...

Greg

"Wes Hutton via .NET 247" <an*******@dotnet247.com> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
I am trying to pass a data object (set or row) into a function byref, and
have the same issue either way. In the main controller function, I have no
issues accessing any parts of my dataset. If I extract a data row, it has
values and is fine. However, when I pass either the whole dataset or just a
data row to another function, it errors out, and in the Locals window just
has "error: cannot obtain value" against every field. I've copied the code
from another class where it works perfectly, can anyone suggest why it all
of a sudden won't let me pass the dataset or components of the dataset
successfully? Also, once this problem occurs, .NET won't let me set the
next statement either.

thanks for your help.

Sample code:

public sub controller()
<get the data here>

'this line works fine
dim intID as integer = objDataSet.Company(0).IDCompany

'now pass the dataset to the function
MapCompany(objDataSet) 'at this point dataset can be accessed
completely
end sub

private sub MapCompany(ByRef objDataset as CompanyDataset) as Company
'at this point the data cannot be read any more
dim intID as integer = objDataset.Company(0).IDCompany
end sub

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>6B+eMxq2P0eSRkcNnoWQug==</Id>
Nov 20 '05 #2

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

Similar topics

3
9166
by: RichW | last post by:
I've seen a couple other posts on this but no real answers. I'm trying to do a bulk insert and everything is fine until I run the objCom.ExecuteNonQuery() statement at which point I get the XML...
3
4733
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
0
1217
by: Arthur Langham | last post by:
I'm passing a dataset from a client to a server component using remoting, and with large datasets I get an out of memory error. The server retrieves the data just fine, however it fails somewhere...
3
13563
by: JJ | last post by:
Hi, I need to pass a dataset to another win form along with a SqldataAdapter. I don't want to recreate the SqlDataAdapter again either. So to pass to another Win form in my windows form app, do...
0
1112
by: Pat | last post by:
All, I wrote a front end of a sql submitter for lack of better words. Simply I am passing in a query ( strSQL ) built in a text box on the client screen. If it runs, I bind the data to a...
2
1368
by: John | last post by:
I am having a weird error and maybe the synatax is different or something. I use a SQL Stored Proc and pass it one param and get a return to either a datareader or dataset. The code works fine for...
22
25544
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
5
1715
by: csgraham74 | last post by:
Hi guys, Basically i have been developing in dotnet for a couple of years but ive had a few issues in regards to error handling. For example - I have a class that i call passing in a stored...
4
5910
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
7100
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
6964
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
7126
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
7175
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...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7330
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...
1
4865
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...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.