473,546 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with DataTable, Insert and FillSchema

Hello all

first let me say i start getting an idea on how powerful data binding
is. You can hold your code as short as possible and also have a pretty
big flexibility.

Also thanks to this great community here, without you i bet many of us
would not succeed that fast.

So now to my problem :)

I use data binding to let the user add/delete/modify data. The user
has one DataGridView, where he only selects the the DataRow, and on
moving in the grid i display the bound data in Textboxes/Comboboxes.

I have one DataSet, one BindingSource and one DataView. All elements
are bound to the BindingSource.
Now on filling the Data i want to use FillSchema to have all those
nice information (Col-Names, max-length, nullable...) grabbed from the
database automatically. This works but my problem comes when adding a
new DataRow to the DataTable.
I do

//======
DataRow insertRow = ds.Tables[kdList.DSTableN ame].NewRow();
insertRow["angelegt_datum "] = DateTime.Now;
insertRow["angelegt_v on"] = Globals.user.id ;
insertRow["id_status"] = Globals.dbLists .GetStatusByNam e( "Initial" );

ds.Tables[kdList.DSTableN ame].Rows.InsertAt( insertRow, 0);
bsKunden.Positi on = 0;
//======

I get an error that some of the fields must not be null (AllowDBNull
of some Cols). I understand why this error occurs but i would like to
know if there is some way to overcome this?

I do not use strong typed DataSets nor do i want to build up the
DataTable by manually. I want to let FillSchema do that for me.

Many thanks in advance

rene

Aug 11 '07 #1
0 1428

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
2199
by: Eva | last post by:
Hi i am trying to insert a new row into one of my datatabels that i have in my dataset when a button is clicked. here is my code Dim ClientInsRow As DataRow = dtClient.NewRo ClientInsRow("Surname") = txtSurname.Tex ClientInsRow("Forename") = txtForename.Tex ClientInsRow("OrgName") = txtOrganisation.Tex ClientInsRow("Address") =...
0
259
by: dave | last post by:
Please help! I have spent all weekend trying to solve this and its driving me mad! I have a form with a datagrid on. When I click button btnNew, the new row appears in the datagrid but it does not update the back end access database. The program continues to the messagebox to say that it has updated it though. I've attached the relevant...
6
16112
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the AutoIncrement Columns to different values but didn't get any errors. Should I be able to set the value of an AutoIncrement Column? I would have thought...
4
1840
by: Jeremy | last post by:
My app is throwing an exception regarding trying to post a null to a required field. Examining the datarow in question, I see a valid date value. The row's state is "added" I'm relying on an oledbcommandbuilder to supply the missing insert or update commands. The following shows how I'm creating my components: Private mdaCertByID As...
0
1095
by: A.J | last post by:
There is a : 1.DataGrid: Columns-->firstName,LastName,EMail,PhoneNumber 2.GroupBox: controls-->4 TextBoxes(firstName,LastName,EMail,PhoneNumber) 3.Both DataGrid and GroupBox are binded to the same datasource(Dataset) and Share the same BINDINGCONTEXT ie on clicking a record in the grid;we can see the same record in the groupbox. ...
1
1708
by: none | last post by:
Hi, I'm trying to establish table mappings, and I've hit a snag. At the point to where I try to fill the schema (DB_adapter.FillSchema), I get an exception, and the message is as follows: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Invalid column name 'Unique_ref'. Invalid column name 'ID_string'. Invalid column...
2
2305
by: Scotty | last post by:
I get stuck to write an update, insert and delete command, i am looking for some help to start Whats the best way to update 2 tables toe the database (Access) below my code used to load my data.(2 tables) Do someone has a good sample code to help me? Many thanks in advance, Marc.
2
1165
by: John | last post by:
Hello, I have create a Client - Server application. When execute client1: all it works When i execute "client2" while "client1" is running and using the database, i receive this error: <<There is already an open DataReader associated with this Command >> I have resolved This problem with: <MultipleActiveResultSets=truein a string...
1
2382
by: Matt | last post by:
I have a C# app where I create an empty datatable using the fillschema method off of the SQLDataAdapter. I populate the datatable from a parsed Excel spreadsheet and then need to update it. I have a small routine where I hand in the datatable and the connection string: string cmd = select * from RecordType1"; SqlDataAdapter sda = new...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.