Click here to Skip to main content
15,893,668 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionOracle Connection fires error as: Database logon failed Pin
Venkatesh Mookkan2-Nov-07 1:40
Venkatesh Mookkan2-Nov-07 1:40 
Questiondatatable to arraylist(avoid duplicate records binding)..., Pin
Member 38798812-Nov-07 0:19
Member 38798812-Nov-07 0:19 
GeneralSecurity code for your registration or login pages pages Pin
Mohammad Mahdi Ramezanpour2-Nov-07 0:09
Mohammad Mahdi Ramezanpour2-Nov-07 0:09 
GeneralRe: Security code for your registration or login pages pages Pin
Dave Kreskowiak28-Nov-07 17:00
mveDave Kreskowiak28-Nov-07 17:00 
QuestionMS WORD Pin
alwinSCH2-Nov-07 0:06
alwinSCH2-Nov-07 0:06 
QuestionRegarding parallel port interfacing and inpout32.dll Pin
Pulkit joshi1-Nov-07 23:20
Pulkit joshi1-Nov-07 23:20 
AnswerRe: Regarding parallel port interfacing and inpout32.dll Pin
Christian Graus2-Nov-07 1:10
protectorChristian Graus2-Nov-07 1:10 
QuestionMerging DataSet = NullRefException ? [modified] Pin
galadrian1-Nov-07 22:20
galadrian1-Nov-07 22:20 
Hi,

I'm having a problem merging datasets to another one. For some reason I keep getting a "Object reference not set to an instance of an object." error.

<br />
Public Shared Function ConvertToNewGenericBon(ByVal anyOrder As DataSet, ByVal anyProduct As DataSet) As NewGenericOrder<br />
        Dim tmp As New NewGenericOrder<br />
        For i As Integer = 0 To anyProduct.Tables.Count - 1<br />
            tmp.Product.Merge(anyProduct.Tables(i))<br />
        Next<br />
        For i As Integer = 0 To anyOrder.Tables.Count - 1<br />
            tmp._NewGenericOrder.Merge(anyOrder.Tables(i))<br />
        Next<br />
        tmp.AcceptChanges()<br />
        Return tmp<br />
    End Function


This is the code I use to merge the datasets. There is a relationship between Product ( = child ) and NewGenericOrder ( = parent ) ! The error occurs while going to the first loop for the second time. So it merges the first Product datatable into the tmp datatable, but not the second. If I comment the first loop and let him run the Order loop, it gives me the error when I'm trying to merge the first datatable. While debugging I can see none of the datatables in anyOrder or anyProduct are null so I don't really know whats causing the error.

However if I make a for each that loops the rows in the datatables and then use .ImportRow, like the code below I don't get any errors.

Public Shared Function ConvertToNewGenericBon(ByVal anyOrder As DataSet, ByVal anyProduct As DataSet) As NewGenericOrder<br />
        Dim tmp As New NewGenericOrder<br />
        For i As Integer = 0 To anyOrder.Tables.Count - 1<br />
            For Each dr As DataRow In anyOrder.Tables(i).Rows<br />
                tmp._NewGenericOrder.ImportRow(dr)<br />
            Next<br />
        Next<br />
        For i As Integer = 0 To anyProduct.Tables.Count - 1<br />
            For Each dr As DataRow In anyProduct.Tables(i).Rows<br />
                tmp.Product.ImportRow(dr)<br />
            Next<br />
        Next<br />
            tmp.AcceptChanges()<br />
            Return tmp<br />
    End Function


Any ideas ?

Tnx in advance !


-- modified at 4:57 Friday 2nd November, 2007
QuestionCall Stack in VB6 Pin
Nitin19811-Nov-07 20:54
Nitin19811-Nov-07 20:54 
AnswerRe: Call Stack in VB6 Pin
Dave Kreskowiak2-Nov-07 2:00
mveDave Kreskowiak2-Nov-07 2:00 
QuestionDesign issues Pin
samerh1-Nov-07 19:45
samerh1-Nov-07 19:45 
QuestionClient server Pin
briogene1-Nov-07 19:25
briogene1-Nov-07 19:25 
AnswerRe: Client server Pin
Steven J Jowett1-Nov-07 21:18
Steven J Jowett1-Nov-07 21:18 
QuestionCrystal reports in vb.net 2003 Pin
poonams1-Nov-07 18:48
poonams1-Nov-07 18:48 
QuestionDataSets, DataTable, DataRow VB.Net 2005 Pin
kendo171-Nov-07 18:17
kendo171-Nov-07 18:17 
QuestionRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
Steven J Jowett1-Nov-07 21:20
Steven J Jowett1-Nov-07 21:20 
AnswerRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
Vimalsoft(Pty) Ltd1-Nov-07 22:18
professionalVimalsoft(Pty) Ltd1-Nov-07 22:18 
GeneralRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
kendo172-Nov-07 0:12
kendo172-Nov-07 0:12 
GeneralRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
kendo172-Nov-07 0:33
kendo172-Nov-07 0:33 
GeneralRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
Vimalsoft(Pty) Ltd2-Nov-07 0:49
professionalVimalsoft(Pty) Ltd2-Nov-07 0:49 
GeneralRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
BooleanTrue2-Nov-07 3:16
professionalBooleanTrue2-Nov-07 3:16 
GeneralRe: DataSets, DataTable, DataRow VB.Net 2005 Pin
kendo172-Nov-07 9:27
kendo172-Nov-07 9:27 
QuestionCRC16 Pin
swampy_in_aus21-Nov-07 16:35
swampy_in_aus21-Nov-07 16:35 
AnswerRe: CRC16 Pin
CPallini1-Nov-07 22:13
mveCPallini1-Nov-07 22:13 
Questionspeeding up web application response Pin
uglyeyes1-Nov-07 16:04
uglyeyes1-Nov-07 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.