I have a C# WPF program that takes a SQL query and populates a column from an Oracle database into a listbox on the form. I would like to be able to compare all items populated in the listbox, and run a SQL query for each item, populating those values into a different listbox.
So far, I have this code:
string sql2 = "select unique apps.fnd_application_all_view.application_name, fnd_responsibility_vl.responsibility_name, fnd_form_functions_tl.user_function_name, fnd_form_functions.function_name, fnd_form_functions_tl.description, fnd_form_functions.type FROM fnd_compiled_menu_functions, fnd_form_functions, fnd_form_functions_tl, fnd_responsibility, fnd responsibility_vl, apps.fnd_application_all_view WHERE
[code]....
I would like to be able to basically take the "Responsibility_Name" value from the first listbox (lstResponsibilities), which is already populated, and use those values to in the "sql2" query to find the "Function_Name" and populate "Function_Name" in the second listbox (lstFunctions).
I want to set the rootpath of an executable application. This rootpath should be the same as the path of an item that I select from a ListBox. The code for selecting the item is as follows.
namespace Menu { public partial class Form1 : Form { private Button button; private ListBox listBox1; private string selecteditem;
[Code] ....
Now what I want is: Whatever I get the output as in the :
Console.Writeline(path + selecteditem),
I would want to set this as a rootpath for an application so as to do rest of the measurements or steps only in that path/folder. Is it possible to do something like this?
Okay so i have everything right accept transfering the selectedindex from listbox in form1 to listbox in form2. I am using the below string item to hold the selected line of the list box, with the intent of recalling and then adding it into the form2 listbox. I get a not implemented error and i can't figure out why. I know the information is moving with the variable item, it just doesn't get printed out to the new listbox.
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
I have a gridview, im using its 'datasource dropdownlist' to populate it, i have the SQL statement
SELECT Orders.ID, OrderDetails.ProductId, OrderDetails.ProductName, OrderDetails.Quantity, OrderDetails.Price, OrderDetails.Total FROM (OrderDetails INNER JOIN Orders ON OrderDetails.ID = Orders.ID) WHERE (Orders.CustomerId = ?)
where the '?' is parameters source = QueryString, and QueryStringField= email
i have a session that is the customerEmailId, so
string CustomerEmailID = (string)Session["email"]; Response.Redirect("MyAccount.aspx?email=" + CustomerEmailID);//i have tested it and customerEmailid is test however nothing loads in the GridView
So I've been working on this for awhile and FINALLY got it to work. This is my code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
[Code] ....
As you can see I will have the Name and total right next to eachother.. Problem is I dont want to make a million MySQLCommands for each ID.. Is there a Way I can list all data in each label?
For instance the Select from Text will show all the text from each different ID and the Select from STOCK-USED as total will show all the total for each ID
Instead of having to list them individually.
Even if I leave it to this
"Select text FROM `parts`";
It selects the 2nd ID in my database and displays its text.. Forgets about the first one completely ...
I have table called leavetable where in i have the fields eid, lfrom,lto, reason,status an employee will insert these fields in the leave form except status, status will be updated by admin but there is no unique field in the table so when the admin updates the status as cancel for an id emp001 so whereever this id is present in the table its getting updated to cancel even though it is approved previously.. How to avoid this duplication ?
SqlConnection con = new SqlConnection(Connectionstring); con.Open(); string sql = "update leavetable set status = '"+status+"' where eid = '"+textBox1.Text+"' and noofdays = '"+textBox5.Text+"'";
I have WCF web service which contains methods for communicating with database (ms sql). For a long time I was using pure sql statements, that aren't secure. It is time to move to parameterized queries. I'm using code-engine.com source code for query builder. Example of it is here: SelectQueryBuilder: Building complex and flexible SQL queries/commands from C# . Which works OK and I have no problems when is used inside of web service.
The problem: I also have asp.net web site which uses this webservice and the main problem is, how to build queries on client side and sent them to web service? I can build query on client side and send dbCommand.commandtext but I then I don't know how to send parameters list to webservice, because it isn't serialized.
This would be used as "universal" method for sql statements. I have others method like getUser(),getUsers(),getPages() but I really need this kind of methods to pass query to it.
I am displaying data from an Excel Spreadsheet through an ASP.net web form using C#. I would like to run an SQL query on the data, but am having trouble figuring out how to use a string in my query.
Here is the code I am running in my .aspx.cs file. I am also using a .aspx to display the data in a GridView.
Ideally, I would like to add a WHERE clause to my string (string sSQL = "SELECT * FROM [Sheet1$A1:D14]"/> in order to query the current month and display the row of said month from the Excel Spreadsheet.
I have attempted to use a DataAdapter to insert the string into the query, but could not figure out how to conform my code to work with it.
what I want to happen is when I click another button called "Apply to all" I want to Update all the daystatus to "Legal Holiday" of the filtered records..I know how to update one by one using simple update..but I need to do the multiple update..
I tried to make a code but it was updating all the records not the filtered only here's my code:
try { OleDbCommand command = new OleDbCommand(); connection.Open(); command.Connection = connection; string query = "SELECT EID From EmployeeTable"; command.CommandText = query; String a = "Legal Holiday";
I am trying to query an Informix database using a List<T> collection's elements as variables. I can build the list and connect to the database, but I am unsure how to iterate through the list and query the database for each item in the collection.
My list is of type string, and contains Order Numbers. I want to query item information for each order number in the list.
I am trying to query dates between two textbox values converted to datetime in C#. The dates are returning in the correct datetime and no conversion problem exists there.
However when I run the below LINQ to SQL query in C# it returns no enumerable results. But if I take the below code:
DbCommand dc = dbHistoryContext.GetCommand(qryRes); Console.WriteLine(dc.CommandText);
and get the results as a string of text and cut and paste that into the SQL Server Management studio and execute it - then it works. What do I need to do to search between two dates so that it properly works. The field is of format Date in SQL Server if that matters and the fields being used to pass the information to it are DateTime. The compiler doesn't show any errors but it just doesn't return results.
var qryRes = (from res in dbHistoryContext.tblR where res.updateddate >= dtDateFrom.Date && res.updateddate <= dtDateTo.Date select res);
I like to read the table and get the all PNAME into the combo box.
Using the below code i can read the table, but while loop takes 2 seconds to read 10 records in the Profilemaster table. How can i reduce the reading time?
My Code is void MainScreen::OnreadProfileName() { CDatabase database; CString SqlString; CString sDsn; CString pname;
[ImportingConstructor] public MainForm([ImportMany] IEnumerable<AudioPlugin> content) {
[Code].....
However, when I add to the listbox as shown above in my main form code the results all show on the same line. My understanding was that they should all be treated as separate because of foreach loop but apparently that is incorrect. I have seen mixed things online some showing that its required to use AddRange instead of Add, however, after literally hours of trying to make this work I am still coming up with nothing. I can't seem to get any code to work using the AddRange or am I finding any way to output each results on a separate line.
I have my ListBox working and I'm able to select the items I want to keep. I'm trying to now get the Invert of the current selection for the items to delete.
I tried using:
if (lstLinePatterns == null) return; for (int i = 0; i < lstLinePatterns.Items.Count; i++) lstLinePatterns.Items[i].Selected = !lstLinePatterns.Items[i].Selected;
But .Selected is giving me an object error.
Is there an easy way to just inverse current selection?
Current Code:
private void btnSelectNonRvt_Click(object sender, EventArgs e) { // Unselects any Items to Prevent Infinite Loop lstLinePatterns.SelectedIndex = -1;
I need to clear a listbox from a class other than the form where it exists. Why this isn't working? I'm getting no error messages when I compile and I am seeing the Console.WriteLine text I also added in the same function. I can call this function from within my form and it behaves as expected. I tried setting the listbox to public despite the fact I wasn't getting protection level errors but that made no difference.
Just to clarify what I'm doing here... I have a form that includes a panel of user controls from another class. So there is a listbox on OtherClass and the listbox is in MyForm. Heres my code:
I am working on a Windows From application on Visual Studio 2010 where i need to use two checkedlistbox that interacts one with the other one. Let say that the first checkedlistbox is for world regions (i.e.):
Asia Africa Europe South America
And let say that the second checkedlistbox is for Countries (i.e.):
Spain Italy Romania Monaco
(all of this belongs to Europe region)
What we need to do is that when the user check on any world region it automatically checks all the countries on that region in the second checkbox, and vice versa if the users check any country on the second checkedlistbox it automatically seconds the region on the first one.
I know that is possible in Java and we know how to do it, but i don't know if C# supports this and how to do it. I was looking on the class information in the microsoft website: [URL] .... but not a concrete example on how to do it.