DataSource Controls :: Trying To Filter The Employees Using A List Of Strings Which Match With The Employee.Name?
Mar 2, 2010
i have an List<String> lstrings which contains a list of strings. If i want to write a linq query on a list<Employees> employees to filter for employees.name in {lstrings} var lquery = (from e in employees where e.Title =="ASP.NET" && e.Name.Contains(lstrings) select e); Im trying to filter the employees using a list of strings which match with the employee.Name
I have two tables.One is registeration table in which we have city,state,country and another is location details table in which we have city(multiple values seperated by commas),state and country also same as city
I want to bind data(For ex: Employee name, Employee ID from Employee) to a dropdownlist and the data should be displayed in dropdownlist as two columns. I don't want to separate this columns by using any special characters like | or '-'. I want to display them as different columns in a dropdownlist.
How can i achieve this using .net and the data i need to retrieve using SQL server 2008.
I have two tables, both contains same properties. The problem is the address spellings MAY vary between table 1 and table 2 but they are actualy same properties. In my sql statement it list out the property that has exactly the same spellling. How do I match the two tables addresses? I heard about fuzzy algorithm but how do I apply it here. I know it wont be perfect but it will be close (check my sql below) I use sql server 05.
Example
Table 1 - 123 greenwood hwy - 123 halo street Table 2 - 123 greenwood highway - 123 halo street SELECT table1.address,table2.street_address FROM table1 INNER JOIN able2 ON table1.address = table2.street_address
My Output returns only one property that has same exact address spellings
The Company table contains any Company with a potential relationship to a "Member". For example:
Companyabc = C (Competitor) Companyxyz = S (Supplier)
When a new Member record is entered, the user selects from two dropdowns: CompanyType (Supplier, Retailer,Competitor); and CompanyName. The CompanyName dropdown is populated depending on the value selected for CompanyType so if the user selects "Supplier" for CompanyType then only those Companies with a CompanyType of "S" for Supplier will be listed in the CompanyName dropdown.
The use can enter up to 10 CompanyType/CompanyName combinations. When the record is saved, these CompanyType/CompanyName combinations are saved in the Member_Company_Link table. One record for each CompanyType/CompanyName combination is entered in the table.
The problem I'm having is in the retrieval process. I have a "search" screen in which users can select certain criteria to list Members by and one of them is CompanyName. For example they want to see all Member records with "company xyz" as a Supplier and/or "companyabc" as a Competitor. Because each Member can have multiple Supplier and/or Comptitor records I can't figure out how to loop through them to match on the value entered by the user. If Member1 has 5 corresponding records in theMember_Company_Link file and 4 of them contain Companies that are Competitors (Competitor1, Competitor2, Competitor3 and Competitor4) and the search criteria is to find records containing "Competitor3" how can I loop through the values in the Member_Company_Link file for each MemberID to see if there is a match for "Competitor3"?
I know this post is too long and most of you will have ignored it by now but I'm hoping someone will have a clue because I've already spent more than a day trying to figure it out. It seems I have to store multiple values in an array but I have no clue how to do this.
Im new to stored procedures so this may seem a stupid question. What i'm trying to do is create a procedure that checks if username and password match, if true then reset the failed password counter to '0'.
The problem i get is that it keeps prompting for a userID as a variable, see code:
This seems like a really silly question, but I've had a search around and I can't find anything about this. I've got a DB connection string that I'm creating in my web.config:-
[Code]....
and
[Code]....
but I need this connection to be read only. I've defined all my linq objects with only gets on their properties, and none of my (MVC) repository classes have .SubmitChanges() methods in them so I'm 99% sure the system can't update this DB, but I would also like to set my DB connection to be RO if at all possible. I realise that ideally this should be done at the SQL server end and the user should be made RO, but that (for various reasons, out of my control) can't be done, so I wanted to lock down my connection as the app mustn't write to the DB.
Is there a "readonly" parameter I can apply to the connection string so that it would throw an error or discard the data if any updates were attempted?
i use 2 dropdownlist with 2 object data source first dropdownlist to display departments name using object datasource (field to display DeptName , value of field DeptID)
second dropdownlist to display Employee name but depend on departments (field to display EmpName , value of field EmpID)
how to display employee name in dropdownlist depend on departments name in the other dropdownlist
2 tables
1 table deprtments with column (DeptID , DeptName , DeptDescription)
2 table Employee with column (EmpID , DeptID , EmpName)
I have an employee salary table with fields empId, month, year, salary. I need query for the following - Total salary drown each employee last year - Id of the employee who got highest salary last year. i am getting wrong o/p for these queries.
I have a drop down with different domains(domain_id column) and a textbox (TextBoxComment) for comments. What I am trying to do is select the area, input a comment, click the button and have it save to the db. My connection string errors on compile.
I have a similar problem. I have one Dynamic Data Website and a thousand databases - one database for each customer. HTe databases have the same schema.
After the users log in I want the Dynamic Data Website to point to a database that belongs to that user.
I am looking for a filtering mechanism, as the user types in the drop down box I want to filter the list to the list items that match what the user is typing. Is there any premade control for this or does anyone know the best way to achieve this feature?
On UI Ajax calendar control is used to allow the user Expiry Date as shown below. As this is one of the controls in search, when the Search button is pressed using SQL statement (copied below) data is retrieved from ExpiryDate column of the table. The table creator declared the column type as string and the dates are saved as single digits(Example: 2/2/10 sometimes and sometime as double digits (Example: 02/02/10) I like to know the best practice in retrieving both type of strings from database table. Calendar control
[Code]....
SQL(part of stored proc)
[Code]....
with in button click event stored procedure is called to return search results.
I've sucefully created a method to insert values through EF, but i've a question (maybe, a newbie question).
Should i send the values to be inserted as strings to the DAL, and then i create the object there or should i create the object in View Layer and then send him to DAL?
Example 1 (DAL):
[Code]....
Example 1 (View Layer, on a click button for example):
[Code]....
Or should i receive the strings in DAL like this: public bool NoticiasInsert(string tituloPT, string tituloEN, string descricaoPT, string descricaoEN)
Then i create the object cdcModel.noticias and set the fields there with the strings values.
What do you advice me to do? I know that both ways works, but i'm trying to develope with better patterns (i don't know if this is the exacly word, sorry my bad english)
cdcModel.noticias campos = new cdcModel.noticias(); campos.tituloPT = "a"; campos.tituloEN = "b"; campos.descricaoPT = "a"; campos.descricaoEN = "a"; if (DAL.NoticiasInsert(campos)
As per ListBox Items a data should show in GridView by using UP and Down arrow keys. I tried by using Oonselectedindexchanged but when a page loads from listbox the cursor become active to inactive.
I have a Gridview with a parameterized SQLdatasource. I want the Gridview to be filter when the a selection is made from the dropdown list Here is what I have. I am missing something.
<asp:SqlDataSource ID="SqlDSAlbums" runat="server" ConnectionString="<%$ ConnectionStrings:Default %>" SelectCommand="SELECT Album.Album, genre.Genre, Band.Band, Album.year, Album.AlbumUID FROM Album INNER JOIN Band ON Album.BandUID = Band.BandUID LEFT OUTER JOIN genre ON Album.GenreUID = genre.GenreUID WHERE (genre.Genre = @Genre) OR (genre.Genre < 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ') ORDER BY genre.Genre, Band.Band" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"> <SelectParameters> <asp:ControlParameter ControlID="ddlGenre" Name="Genre" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDSGenre" runat="server" ConnectionString="<%$ ConnectionStrings:Default %>" SelectCommand="SELECT Genre, GenreUID FROM genre Order by Genre"></asp:SqlDataSource> Select a Genre <asp:DropDownList ID="ddlGenre" runat="server" DataSourceID="SqlDSGenre" DataTextField="Genre" DataValueField="Genre" AppendDataBoundItems="True" AutoPostBack="True"> </asp:DropDownList> <asp:GridView ID="gvAlbum" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDSAlbums"> <Columns> <asp:BoundField DataField="Album" HeaderText="Album" SortExpression="Album" /> <asp:BoundField DataField="Genre" HeaderText="Genre" SortExpression="Genre" /> <asp:BoundField DataField="Band" HeaderText="Band" SortExpression="Band" /> <asp:BoundField DataField="year" HeaderText="Year" SortExpression="year" /> <asp:TemplateField HeaderText="Comments"> <ItemTemplate> <asp:HyperLink ID="hlToComments" HeaderText="Comments" runat="server" NavigateUrl='<%# String.Format("ViewComments.aspx?AlbumUID={0}", Eval("AlbumUID")) %>' Text="Click Here" /> </ItemTemplate> </asp:TemplateField>
I am trying to create an MVC List View that can be filtered by the value selected from a drop down list.
Selecting a value should repost the page ... Since there is no concept of view state data I am having some issues with this ... I can get the repost to take place but my drop down resets and I am not able to get the value that was selected.
ASSET CONTROLLER:
[Code]....
[Code]....
I have tried many of the posts that refer to setting up drop down lists but can't set them up in the content because this is a List View.
I have the following stored procedure and if I execute this on our SQL analyser it returns the record no problem what so ever. BUT if I execute this through ASP.NET (I am using EntitySpace objects) to generate this query into data table and it saying that: "Cursorfetch: The number of variables declared in the INTO list must match that of selected columns."
I've discussed this with EntitySpace team and they said it's query issue? We are stuck with this issue and any guidance or hints that will be good.
The environment that we use:
.NET 4 EntitySpace 2010 SQL Server 2005 Database ALTER PROCEDURE [dbo].[rpt_CPRRespondListReport] ( @SurveyID INT ) AS BEGIN SET NOCOUNT ON;