c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb(165): 'System.Data.DataRow.Protec

  • Thread starter Thread starter new2.NET
  • Start date Start date
N

new2.NET

Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance of
an object error. And if I try to create a new DataRow with
this code, I get the compiler error in the subject line. I
don't know how to handle this or how to change my code to
make it work. Below is my code which I cannot get to work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET
 
I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.
-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance of
an object error. And if I try to create a new DataRow with
this code, I get the compiler error in the subject line. I
don't know how to handle this or how to change my code to
make it work. Below is my code which I cannot get to work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.
 
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.
-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance of
an object error. And if I try to create a new DataRow with
this code, I get the compiler error in the subject line. I
don't know how to handle this or how to change my code to
make it work. Below is my code which I cannot get to work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.
 
when i do not include the New, i run into the browser
error that states "object reference not set to instance of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.
-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

"new2.NET" <[email protected]> wrote
in
message
Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an
instance
of
an object error. And if I try to create a new DataRow with
this code, I get the compiler error in the subject line. I
don't know how to handle this or how to change my code to
make it work. Below is my code which I cannot get to work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.


.
 
In which row happens the error (when you are nto using new)?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

when i do not include the New, i run into the browser
error that states "object reference not set to instance of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.

-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

message
Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance
of
an object error. And if I try to create a new DataRow
with
this code, I get the compiler error in the subject
line. I
don't know how to handle this or how to change my code
to
make it work. Below is my code which I cannot get to
work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in
the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.


.
 
good morning, the row which the error occurs is:

Dim rowNew as DataRow

the object reference error comes up with this row
highlighted.

-----Original Message-----
In which row happens the error (when you are nto using new)?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

when i do not include the New, i run into the browser
error that states "object reference not set to instance of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.

-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

message
Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance
of
an object error. And if I try to create a new DataRow
with
this code, I get the compiler error in the subject
line. I
don't know how to handle this or how to change my code
to
make it work. Below is my code which I cannot get to
work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in
the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.



.


.
 
Huh, this is only a declaration and it shouldn't yield an error.
What's the line before this one?
 
good morning again, i've captured my error below. i've
also re-written my code so it is more adapted to my User
table in the database. I'm not sure why it gives me this
error, but i've checked the data adapter, made sure the
data set was filled with the Fill(), and i'm still getting
the same error at the same row 182:

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.

Source Error:


Line 180: 'create a new row for the dataset
Line 181: Dim rowNew As DsUser.UserRow
Line 182: rowNew = dsUser.User.NewUserRow()
Line 183: 'add data to the row
Line 184: rowNew("userID") = txtUserID.Text


Source File:
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb Line:
182

Stack Trace:


[NullReferenceException: Object reference not set to an
instance of an object.]
PZIssueTracker.User.butAddUser_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb:182
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve
ntHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()


i apologize if i'm not efficient in explaining my error;
i'm just trying to learn VB.NET and ADO.NET at the same
time.

sincerely,
trisha
-----Original Message-----
In which row happens the error (when you are nto using new)?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

when i do not include the New, i run into the browser
error that states "object reference not set to instance of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.

-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

message
Hi. I'm new to databinding and all that ADO.NET stuff. I
keep getting an object reference not set to an instance
of
an object error. And if I try to create a new DataRow
with
this code, I get the compiler error in the subject
line. I
don't know how to handle this or how to change my code
to
make it work. Below is my code which I cannot get to
work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in
the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.



.


.
 
An instance of dsUser or dsUser.User doesn't exist....

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

good morning again, i've captured my error below. i've
also re-written my code so it is more adapted to my User
table in the database. I'm not sure why it gives me this
error, but i've checked the data adapter, made sure the
data set was filled with the Fill(), and i'm still getting
the same error at the same row 182:

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.

Source Error:


Line 180: 'create a new row for the dataset
Line 181: Dim rowNew As DsUser.UserRow
Line 182: rowNew = dsUser.User.NewUserRow()
Line 183: 'add data to the row
Line 184: rowNew("userID") = txtUserID.Text


Source File:
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb Line:
182

Stack Trace:


[NullReferenceException: Object reference not set to an
instance of an object.]
PZIssueTracker.User.butAddUser_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb:182
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve
ntHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()


i apologize if i'm not efficient in explaining my error;
i'm just trying to learn VB.NET and ADO.NET at the same
time.

sincerely,
trisha
-----Original Message-----
In which row happens the error (when you are nto using new)?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

when i do not include the New, i run into the browser
error that states "object reference not set to instance of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.

-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

in
message
Hi. I'm new to databinding and all that ADO.NET
stuff. I
keep getting an object reference not set to an
instance
of
an object error. And if I try to create a new DataRow
with
this code, I get the compiler error in the subject
line. I
don't know how to handle this or how to change my code
to
make it work. Below is my code which I cannot get to
work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in
the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.



.


.
 
thank you for all of your help on this. i was informed
that VB.NET creates an adapter object for use with the sql
commands. also, i did not instantiate a NEW DsUser. after
reading it over a few times, i realized my own folly. the
only adjustment was to add the keyword New to my
declaration.

sincerely,
trisha

-----Original Message-----
An instance of dsUser or dsUser.User doesn't exist....

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

good morning again, i've captured my error below. i've
also re-written my code so it is more adapted to my User
table in the database. I'm not sure why it gives me this
error, but i've checked the data adapter, made sure the
data set was filled with the Fill(), and i'm still getting
the same error at the same row 182:

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.

Source Error:


Line 180: 'create a new row for the dataset
Line 181: Dim rowNew As DsUser.UserRow
Line 182: rowNew = dsUser.User.NewUserRow()
Line 183: 'add data to the row
Line 184: rowNew("userID") = txtUserID.Text


Source File:
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb Line:
182

Stack Trace:


[NullReferenceException: Object reference not set to an
instance of an object.]
PZIssueTracker.User.butAddUser_Click(Object sender,
EventArgs e) in
c:\inetpub\wwwroot\PZIssueTracker\User.aspx.vb:182
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve
ntHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()


i apologize if i'm not efficient in explaining my error;
i'm just trying to learn VB.NET and ADO.NET at the same
time.

sincerely,
trisha
-----Original Message-----
In which row happens the error (when you are nto using new)?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone- si.info

when i do not include the New, i run into the browser
error that states "object reference not set to
instance
of
an object" and i cannot get past it.

again, many thanks.
-----Original Message-----
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()

This is the correct way. What's wrong with this approach?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

I get this error if i instantiate the rowNew as a New
DataRow, but if I don't use it, on the browser I get an
object not instantiated error.

thanks
'System.Data.DataRow.Protected Sub New(builder As
System.Data.DataRowBuilder)' is not accessible in this
context because it is 'Protected'.

-----Original Message-----
What is the error?

--
Miha Markic [MVP C#] - RightHand .NET consulting &
development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-
si.info

in
message
Hi. I'm new to databinding and all that ADO.NET
stuff. I
keep getting an object reference not set to an
instance
of
an object error. And if I try to create a new DataRow
with
this code, I get the compiler error in the subject
line. I
don't know how to handle this or how to change my code
to
make it work. Below is my code which I cannot get to
work.

'create a new row for the dataset
Dim rowNew As DataRow
rowNew = dsUser.Tables("User").NewRow()
'add data to the row
rowNew("userID") = txtUserID.Text
rowNew("userfName") = txtFirstName.Text
rowNew("userlname") = txtLastName.Text
rowNew("userDeptName") = txtDeptNumber.Text
rowNew("userEmail") = txtEmailAdd.Text
rowNew("userSupervisorID") = txtSuperID.Text
'add the row to the data set
dsUser.Tables("User").Rows.Add(rowNew)
'update database
adptUser.Update(dsUser, "User")

'rebind each text box to a different column in
the
** code removed
dataset

Try
'modify the database
adptUser.Update(dsUser)
** code removed

Thanks in advance.
new2.NET


.



.



.


.
 
Back
Top