473,287 Members | 1,663 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,287 software developers and data experts.

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.DSTableName].NewRow();
insertRow["angelegt_datum"] = DateTime.Now;
insertRow["angelegt_von"] = Globals.user.id;
insertRow["id_status"] = Globals.dbLists.GetStatusByName( "Initial" );

ds.Tables[kdList.DSTableName].Rows.InsertAt(insertRow, 0);
bsKunden.Position = 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 1408

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

Similar topics

23
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 ...
0
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...
6
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...
4
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 ...
0
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...
1
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:...
2
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...
2
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:...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
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: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...

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.