467,876 Members | 1,129 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,876 developers. It's quick & easy.

Accessing dataset datatable table row problem

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
  • viewed: 2384
Share:
2 Replies
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
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.

Similar topics

1 post views Thread by Fleckman | last post: by
15 posts views Thread by JIM.H. | last post: by
5 posts views Thread by Roy Lawson | last post: by
16 posts views Thread by Geoff Jones | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.