Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sun, 29 Jan 2006 12:57:27 -0800,    group: microsoft.public.dotnet.datatools        back       


Get a specific record's data   
helo all
i'm quite new to vb.net
i'm trying to use the online help suggestion that's supposed to load a 
specific table row into a variable:

Dim Lnrow As paraohDataSet.LoansRow
Lnrow = ParaohDataSet.Loans.FindBylID(5)

trying to use it to reach any value, like using this line:
LID.Text = Lnrow.lID

causes an error : "Object reference not set to an instance of an object."

since that's exactly as it is in help, i cant find where i do wrong
please help
thanx
Erez.
date: Sun, 29 Jan 2006 12:57:27 -0800   author:   Erez Mor

Re: Get a specific record's data   
"Erez Mor"  wrote in message 
news:C05A493A-A477-41D4-83CA-15E17887A5D1@microsoft.com...
> helo all
> i'm quite new to vb.net
> i'm trying to use the online help suggestion that's supposed to load a
> specific table row into a variable:
>
> Dim Lnrow As paraohDataSet.LoansRow
> Lnrow = ParaohDataSet.Loans.FindBylID(5)
>
> trying to use it to reach any value, like using this line:
> LID.Text = Lnrow.lID
>
> causes an error : "Object reference not set to an instance of an object."
>
I see two possible solutions: one is that you'll get the error if you don't 
instantiate the datarow with 'New' like this:
    Dim Lnrow As New paroahDataSet.LoansRow

But if you're getting a datarow from FindByID you shouldn't need to do 
that - you'll get a reference to the row in the table *unless* there is no 
row found, in which case you have no object which takes us back to square 
one.

My suggestion would be to check to be sure that you get a row from FindByID 
before going any further:

    If Not IsNothing(Lnrow) Then
        LID.Text = Lnrow.1ID
    Else
        'Handle row not found error here
    End If

hth;

DCraig.
date: Tue, 31 Jan 2006 15:17:01 -0800   author:   DCraig

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us