datacolumn

How to access Parents Child in DataColumn Expression

I've a DataSet with 3 DataTables: dtPerson dtSalary dtFriend Every person has salaries, and every person has one friend. I've added a column dcHisFriend into dtSalary and would like to display friend name of a person owning specified salary. So dtPerson has a column NAME, dtSalary has column VALUE and dtFriend has a c...

DataColumn.Expression Power

the following code Dim dc = New DataColumn(name, GetType(Double), "[col1] ^ [col2]") produces the following error: The expression contains unsupported operator '^'. Is this right, is the power operand not support in datacolumn expressions??? Anyone have an idea how i'd write this? ...

datacolumn format as currency in .NET

Can I format the type of a datacolumn of a dataset to currency (for a specific culture) before binding it to the grid ...

Can i store serializable array data in DataColumn?

I am trying to automatically convert object's properties to DataTable (object is array and has properties that instantiated from special class which has value type). The code: static public DataTable f_GetDataTableFromClassObject(object _objInstance) { // geri dönecek datatable DataTable dataTable = new DataTable(); // ne...

How do I Pull a Single Column of Data out of a Filled DataSet?

How do I pull a single column of data out of a filled dataset? I have a filled dataset object, with a variety of tables. I need to get all of the data that is stored in a particular column in one of the tables, and bind a ComboBox ItemSource to it. (This may require me to pull the data out and make it into a string collection ...) ...

Create ADO.NET DataView showing only selected Columns

In C# & .NET, can one create a DataView that includes only a proper subset of the DataColumns of a given DataTable? In terms of relational algebra, one assigns a RowFilter in order to perform a "selection" operation (). How would one perform a "projection" operation ()? ...

C#: How do I iterate the contents in a DataColumn?

I have a database column I simply need to check to see if a value is there. DataTable dt = masterDataSet.Tables["Settings"]; DataColumn SETTINGS = dt.Columns["DEFAULTSETTINGS"]; I just need to iterate over the values in this column to see if a value exists. Help ...

Customize DataColumn.Expression handling in C#

I would like to change behavior of DataColumn.Expression so that when I write: DataColumn.Expression = "MyMethod(Price)" it will call MyMethod, pass value from Price column into it and display evaluated value. How to acomplish this? ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#? ...

Determine if DataColumn is numeric

Is there a better way than this to check if a DataColumn in a DataTable is numeric (coming from a SQL Server database)? Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("Get_Some_Data"); DataSet ds = db.ExecuteDataSet(cmd); foreach (DataTable tbl in ds.Tables) { foreach (DataColumn col...

Update DataColumn's with latest column information

I have a dataset with a number of data columns, due to sizing issues I've updated a number of the varchar columns from say VARCHAR(20) to VARCHAR(50). I'd like the DataTable to automatically grab the new column information, is this possible? I'd rather not go through each column in the table and update the length. ...

Would it be possible to extend the DataColumn.Expression

Could extension method be used for DataColumn.Expression to support for example the replace function ? If yes, any sample code available somewhere ? Thanks. ...

Using an (I)List<string> as the source for a DataColumn

I'm playing around with the DataGridView control offered by .NET. Upon till now I seem to be unable to bind an (I)List to a DataColumn. Is this possible and how should I go around doing this? ...

Seeing named datacolumns in Visual Studio debugger?

When I'm debugging a datatable, say in the watch window, I'll often choose the Rows property, and then a particular index-- 0 or 1, often times. When I do that, I see an ItemArray list with numeric indexing, representing the columns for the row. But the columns have names, and I'd like to see them. So instead of myTable.Rows[0][6] ....

Convert string to guid in DataColumn

How do you convert a DataColumn of GUIDs set as type string to a DataColumn of GUIDs where the type is Guid? A column in the source data has the wrong type and I cannot change it there. ...

ADO.net Question - How can I update a column in a Row of a DataTable with RowChanged without triggering infinite loop?

Hi, How can I update the column value (programmatically) in a Row of a DataTable via use of the RowChanged event, without triggering infinite loop? (which I currently get) Note I do not want to use the DataColumn.Expression property. For example the following gives me a recursive loop and stack overflow error: DataColumn dc = new...

Problem with MultiColumn Primary Key

DataTable NetPurch = new DataTable(); DataColumn[] Acct_n_Prod = new DataColumn[2]; DataColumn Account; Account = new DataColumn(); Account.DataType = typeof(string); Account.ColumnName = "Acct"; DataColumn Product; Product = new DataColumn(); Product.DataType = typeof(string); Product.ColumnName = "Prod"; NetPurch.Columns.Add(Accoun...

How do I get column names to print in this C# program?

I've cobbled together a C# program that takes a .csv file and writes it to a datatable. Using this program, I can loop through each row of the data table and print out the information contained in the row. The console output looks like this: --- Row --- Item: 1 Item: 545 Item: 507 Item: 484 Item: 501 I'd like to print the column nam...

Can I configure a strongly typed data set to use nullable values?

If I have a strongly typed data table with a column for values of type Int32, and this column allows nulls, then I'll get an exception if I do this for a row where the value is null: int value = row.CustomValue; Instead I need to do this: if (!row.IsCustomValueNull()) { int value = row.CustomValue; // do something with this v...

How to make totals of the datatable cells and construct a new column in that datatable ?

There are three columns in the datatable Amount Commission Others 1000 200 100 2000 100 200 Now I want to build another column based on these three columns name totalAmount that is the sum of these three columns like the column will be totalAmount 1300 2300 I got the records of the three columns Amount,Commission...