473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
2 1804
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: theWizK | last post by:
Hello all. I have noticed that when I generate a strongly-typed dataset from an xml schema that the DataTables that are generated have their constructors marked as internal. What this means is...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
1
by: Fleckman | last post by:
I have a situation where I need to add rows to tables with a Parent-Child relationship which presents a constraints violation when I reject the changes. Here is the scenario: I add a row to a...
1
by: Moojjoo | last post by:
Good Monday Morning: I am at a dead stop and I am hoping some other developers out there can help me out. I have built a dataset that first contains a table populated from SQL Server then I am...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
0
by: N. Demos | last post by:
Hello, I'm having problems accessing a complex XML child node (latitude & longitude), and passing it to a function when the XML file has been read into a DataSet. Specifically, the returned object...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
2
by: Tony Girgenti | last post by:
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...
12
by: Andy B | last post by:
I need to custom build and use a dataset in c# to use with xml. Does anybody know where I can find out how to do something like this? I was going to create a class that generated the dataset and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.