By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,143 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,143 IT Pros & Developers. It's quick & easy.

Accessing dataset datatable table row problem

P: n/a
Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a Dataset.

In looking for a way to start adding data to the dataset programmatically, i
found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found for
type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for days.

Any help would be gratefully appreciated.

Thanks,
Tony
Sep 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you have created a DataSet, you should have a class already defined. You
will instantiate that class, not DataSet. For example, you add a DataSet
called CustomersDS. The line would be:

Dim custDS as New CustomersDS()

If you are doing this on the fly, at runtime (ala the example you gave), you
will NOT have intellisense, as something created at runtime is not available
at design time.

Once you instantiate as a strongly typed dataset, you should be in good
shape. The type of row you will want to add, however, is of the type of the
name of the table and you will pull it from the methods in the strongly
typed dataset instead of a generic new row.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a Dataset.

In looking for a way to start adding data to the dataset programmatically,
i found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found
for type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for days.

Any help would be gratefully appreciated.

Thanks,
Tony

Sep 17 '06 #2

P: n/a
OK. Now i have it like this:

Dim tripsDataSet As New tripsDS
Dim tripsDataTbl As New tripsDS.tripsTableDataTable
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
Dim foundTrips As DataRow
foundTrips = tripsDataTbl.NewRow

When i run it, it blows up on the ReadXmlSchema line with " Invalid 'Key'
node inside constraint named: tripsTableRel".

I'm not sure i follow what you are trying to explain to me.
>If you are doing this on the fly, at runtime (ala the example you gave),
you
will NOT have intellisense, as something created at runtime is not available
at design time <<

Is there another way to do this if not at run time ?
>The type of row you will want to add, however, is of the type of the
name of the table and you will pull it from the methods in the strongly
typed dataset instead of a generic new row <<

The table i defined has a row type ?

I hope you don't mind me asking so many questions. It's just that i am
trying to learn this new technology and i spend days on trying to resolve
problems by researching and reading. My posts here usually come after that
and when i get a reply, i try to seize the opportunity to learn as much as i
can from a knowledgeable individual such as yourself.

Thanks,
Tony

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:e8**************@TK2MSFTNGP02.phx.gbl...
If you have created a DataSet, you should have a class already defined.
You will instantiate that class, not DataSet. For example, you add a
DataSet called CustomersDS. The line would be:

Dim custDS as New CustomersDS()

If you are doing this on the fly, at runtime (ala the example you gave),
you will NOT have intellisense, as something created at runtime is not
available at design time.

Once you instantiate as a strongly typed dataset, you should be in good
shape. The type of row you will want to add, however, is of the type of
the name of the table and you will pull it from the methods in the
strongly typed dataset instead of a generic new row.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a
Dataset.

In looking for a way to start adding data to the dataset
programmatically, i found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Co yneTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found
for type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for
days.

Any help would be gratefully appreciated.

Thanks,
Tony


Sep 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.