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...
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?
...
Can I format the type of a datacolumn of a dataset to currency (for a specific culture) before binding it to the grid
...
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?
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 ...)
...
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 ()?
...
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
...
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?
...
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#?
...
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...
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.
...
Could extension method be used for DataColumn.Expression to support for example the replace function ?
If yes, any sample code available somewhere ?
Thanks.
...
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?
...
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]
....
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.
...
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...
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...
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...
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...
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...