I am using asp.net 2.0 and c#.
I have a dataset, which is getting the employee info. Now I want to filter the gridview based on a name that the user has put in the search textbox.
I am doing this:
DataSet ds = new DataSet("EmployeeInformation");
//........ loading DataSet ds with emploee info
string strExpr;
strExpr = "Name LIKE %" + txtSearchEmployee.Text.Trim() + "%";
ds.Tables[0].Select(strExpr);
I am getting an error in the last step, that the operator is missing.
Please guide me how can I achieve this. Thanks in advance.
You just need to add single quotes around your LIKE criteria:
strExpr = "Name LIKE '%" + txtSearchEmployee.Text.Trim() + "%'";
ds.Tables[0].Select(strExpr);
Related
Hello i work with the Framework Dhtmlxgantt. And i would like to change the height of the Task Bars. They are to big for me and i would like to have id smaller. Is this possible? Because i search alot and i dont find anything about that. And i have another Problem. I have in my Database some Projects and a part of them has in the Titel html tags and the other not. The result is in the Gantt chart is the Titel field in diffrent font size what looks stupid. So is there a way to change that before id rendert on the Gantt chart or have i to change all Titel's in the Database? I hope some of you can help me. Greece
try this to set height
gantt.config.row_height = 36;
gantt.config.task_height = 20;
gantt.config.scale_height = 50;
To set task text use templates
gantt.templates.task_text=function(start, end, task) {
return "anything you want";
};
You can return task.text or task.id or "(" + task.text + " id = " + task.id + ")"
It seems to be easy )
I am creating pivot table in xlsx using poi and java.Here i have some questions,Please let me know if you guys know any solutions.
My Code is below
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = (XSSFSheet) wb.createSheet();
XSSFPivotTable pivotTable = sheet.createPivotTable(new AreaReference("A1:E4"), new CellReference("H5"));
pivotTable.addRowLabel(0);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 1);
Manually , we can create pivot the data in xlsx.But using poi, I feel some difficulties.
To add Fields in "Page Fields", addReportFilter can be used.
To add Fields in "Row Fileds", addRowLabel can be used
To add Fileds in "Data Fields", addColumnLabel can be used
To add Fields in "Column Fields", Which method can we use? Is there any option ?
And there is a method, "addDataColumn". I can't understand the purpose of this method.While trying it,i didn't get anything.
Please help me...
I'm investigating for a client feature and I didn't reach the right answer.
This is quite simple : the user edits a full table with datas ( numbers ), chooses which cells receive the sum of which cells and export it.
In Angular we can keep the calculation and hide it to show the result. But what I would like to do is to keep the calculation active when exporting on xls.
For ex.
Cell1 = 25 Cell2 = 45
Cell3 = 70 (Sum(Cell1,Cell2));
In the XLS file It should keep the Sum() function instead of a "flat" 70.
Am I clear enough ? Does someone know a library that can do this ? or the best process to succeed in this feature ?
Excel files are essentially XML Documents.
However building Excel using plain XML is a crazy job...
You can try using the library (ClosedXML) if you are using .NET. https://closedxml.codeplex.com/
It makes much easir to build Excel files.
var wb = new XLWorkbook();
var ws = wb.AddWorksheet("Sheet1");
ws.Cell("A1").SetValue(1).CellBelow().SetValue(1);
ws.Cell("B1").SetValue(1).CellBelow().SetValue(1);
ws.Cell("C1").FormulaA1 = "\"The total value is: \" & SUM(A1:B2)";
var r = ws.Cell("C1").Value;
Assert.AreEqual("The total value is: 4", r.ToString());
// It also works if you use: ws.Cell("C1").GetString()
I'm working on a WPF application and i cant seem to get this right. I am brand new to WPF.
I want to get the text from the database into text boxes but i tried it with only one textbox the first time and i get this error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: No value given for one or more required parameters.
This is the code i have so far, this is how it's done in winforms but i suppose not the same in WPF
dbconn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=ChampInfo1.accdb");
dbconn.Open();
string selectallSQL = "SELECT Passive " +
"FROM BChampInfo " +
"WHERE [Champ Name] = Aatrox";
dbcomm = new OleDbCommand(selectallSQL, dbconn);
OleDbDataReader dbread = dbcomm.ExecuteReader();
while (dbread.Read())
{
txtskillname1.Text = dbread["Passive"].ToString();
}
I don't know what is wrong though, any help will be appreciated.
All my oledb declaration are done at the top.
It can be the easy target for sql injection. The problem is in query. Try this
string selectallSQL = "SELECT Passive " +
"FROM BChampInfo " +
"WHERE [Champ Name] = ?";
dbcomm = new OleDbCommand(selectallSQL, dbconn);
dbcomm.Parameters.AddWithValue("#aat", "Aatrox");
I have a rather simple question. I'm trying to get information out of an XML file, and now I need to get the that's inside another
This is my XML code:
<author>
<name>Random_name1 (Random Name)</name>
<uri>http://thisisanrandomurl.com</uri>
</author>
I can get the info with this code:
Name = item.Element(ns + "author").Value,
But this gives me:
"Random_name1 (Random Name) http://thisisanrandomurl.com"
I only want the info inside the tags. Any ideas?
Thanks a lot,
- Niels
Are you using LINQ to XML? Try:
Name = item.Element(ns + "author").Element(ns + "name").Value;
to get the data inside the 'name' element. You can use Elements if there is more than one, and then use LINQ statements to select the one you want.
using System.Xml;
After then please write this code
XmlDocument myxml = new XmlDocument();
myxml.Load("D:/sample.xml");//Load you xml file from you disk what you want to load
string element_1 = myxml.GetElementsByTagName("name")[0].InnerText;
string element_2 = myxml.GetElementsByTagName("uri")[0].InnerText;
Please try this it will be useful to you...