FAQ Database Discussion Community


C# Filter DataTable with multiple keys (columns) and multiple values

c#,datatable,dataview
I have a table with three columns A, B and C, where A, B are the keys and C is the corresponding value. I've trying to filter it with multiple values for the keys. In order to do that, I've tried: // Initialise some data DataTable dt = new DataTable();...

Cannot perform = operation between int32 and string. datarow filter

c#,sql,dataview
First of all I apologies for the paraphrasing I will be doing, I do not have access to my code right now and am on my phone but wanted to get this posted so that when I do have access later I hopefully have an answer. If i don't I...

Add Column to DataTable before exporting to Excel file

vb.net,excel,datatable,type-conversion,dataview
I have a DataTable that is built like this: Dim dt As New DataTable() dt = SqlHelper.ExecuteDataset(connString, "storedProcedure", Session("Member"), DBNull.Value, DBNull.Value).Tables(0) Then it is converted to a DataView and exported to Excel like this: Dim dv As New DataView() dv = dt.DefaultView Export.CreateExcelFile(dv, strFileName) I want to add another column...

Avoid repeating columns in DataTable?

c#,datatable,dataview
This is my DataTable: ItemPartNumber VendorName Price ANNF213 SAMSUNG 265.41 GDFF31D HP 65.10 ANNF213 APPLE 115.51 FSF2122 MICROSOFT 655.47 GDSGG32 NOKIA 250.58 ANNF213 SAMSUNG 225.40 It has ANNF213 three times. I want to take only the first one, and wish to omit the rest rows. Desired Output DataTable: ItemPartNumber VendorName...

DataView in AMPScript

dataview,exacttarget,ampscript
Is it possible to access SendLog and DataView data i.e. _Click via AMPScript to populate email content? Something like: %%[SET EmailContent = _Click(linkName);]%% I know how to run SQL query and save this as a Data Extension but I'd like to use it on the fly. Does anyone know how...

How to create a DataView RowFilter that can filter if the input string is a substring of the string in the desired column

c#,regex,string,dataview,rowfilter
I would like to create a DataView RowFilter that can filter if the input string is a substring of the string in the column. For example, if the datatable dt has the column "Name", with the string values "Mary" in one row and "John" in the other. I want to...

how to display dates from two different tables?

c#,mysql,visual-studio,dataview
In a DataView I am displaying two dates from two different tables in a database. Service date from maintenance table and Checklist date from fleetchecklist table. Both columns are called Date in the database tables. The problem is its only displaying one date (checklist date). Service date should say 14/06/2015....

dataview.rowfilter syntax error - missing operand mystery

vb.net,datagridview,datatable,dataview,rowfilter
Weird, weird error. I might just be codeblind, but: Dim dtdv As New DataView dtdv = dt.DefaultView dtdv.RowFilter = "Controller ID = 'PS2USB1'" XMLDGV.DataSource = dtdv produces, at line 3: Missing operand after 'ID' operator. dt defined and correct. Column heading correct. Weird. Any ideas?...

How to Filter a DataView by another datatable row attribute

c#,datatable,dataview
I have 2 methods that I do not have any control over. One returns me all dates with needed unique code(one of the row column row[code]) as DataView. DataView allDatesWithCode= portal.GetAllDatesWithCode(); And another method returns me only available dates but without the code. DataTable availableDates = portal.GetAvailableDates(); Both allDatesWithCode and...