Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2008, 09:49 PM
Authorized User
 
Join Date: Aug 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to humour
Default Create new row using a typed dataset

I am using a strong-typed dataset object (.xsd) object - simplistic at this point to illustrate the problem.

What I want is code to

a) Insert a row into a dataset object
b) Bind the dataset to the gridview, the gridview should show the data.
c) If the user wants to edit the gridview data they can.
d) The data should be committed to the database after.

This is the code I have so far - the error message I am getting is below it, the table definition is below the error message.

Dim dt As New table2.Table2DataTable
dt.BeginLoadData()
Dim dr As DataRow = dt.NewRow
'
dr("fld1") = "a"
dr("fld2") = "b"
dt.LoadDataRow(dr.ItemArray, False)
dt.EndLoadData()

error message: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Table2
ID - Integer- Identity Column
fld1 - varchar2(10)
fld2 - varchar2(10)





Similar Threads
Thread Thread Starter Forum Replies Last Post
insert nulls using a typed dataset humour ASP.NET 2.0 Professional 3 April 16th, 2008 05:17 AM
Converting a untyped dataset to a typed dataset daphnean Visual Studio 2005 0 July 13th, 2006 01:16 AM
What Are Typed Dataset vinod_pawar1 ADO.NET 2 May 13th, 2005 04:52 AM
Dynamic DataAdapter from Typed Dataset dhay1999 ADO.NET 3 May 3rd, 2005 07:07 AM
Crystal Report and Strongly-Typed dataset jaucourt Crystal Reports 1 February 9th, 2004 07:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.