Im trying to change the information on each row depending on the result from the query. Im thinking that at the minute my problem is that I'm only returning the first result from the query into the result.
e.g. query returns row 1 with '1232' row 2 '1243' but result is only ever set to '1232'
I have this ListView that has a Drop Down List.Everything works fine (I think/hope) except that the drop down list are not showing its result correctly.This is the code.
Front-End [Code]....
The code behind consist of the page_load and the ItemDataBound [Code]....
I'm having a problem with my Linq to XML query. I'm getting the result data I want, but it's nested so deep that there must be a better way.Here is my XML:
[Code]....
I'm trying to get a list (simple string[]) of all Item IDs where Category Names contains "Other".Here is my Linq:
[Code]....
[Code]....
Here is a snapshot of my result from Visual Studio:The results I want are there ("item100", "item400", "item500"), but buried so deeply in the results var.
I can't seem to figure out how to write this query properly. I've tried various combinations but nothing's worked yet. Below is the relevant portion of my database model: I need to select the products that match a given Category and Group, and that match a given Year, Make, Model, submodel. This I've done below:
ItemList = From P In gDataContext.Products.Include("Groups").Include("Groups.Category1").Include("LookupYearMakeModels") From G In P.Groups Where G.Category = Cat And G.Grp = Group From Y In P.LookupYearMakeModels Where Y.Year = YMM.Year And Y.Make = YMM.Make And Y.Model = YMM.Model And Y.Submodel = YMM.Submodel Select P
I now also have to select products that match the Category, and Group but are Universal (Product.Univeral = True). I'm currently writing two queries, the one above and the one below. I'm merging the results of the two by simply using ItemList.AddRange(ItemList2) ItemList2 = From P In gDataContext.Products.Include("Groups").Include("Groups.Category1") where P.Universal From G In P.Groups Where G.Category = Cat And G.Grp = Group Select P But I want to combine both queries into one and avoid merging the results. How can I do it?
I have a gridview to populate some data and I am using the following function to merge the cells, rowwise. Now I want to apply alternate colors to the grouped cells.
I am trying to display this query result in an aspx page.
It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)
select
top 500
--This column is the issue ,Governing_Class=( case when exists (select top 1 tqc.class_code from t_quote_class tqc inner join t_quote_class_premium tqcm on tqc.class_code =tqcm. class_code where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380') order by tqcm.premium_amt desc ) then ( select top 1 tqc.class_code from t_quote_class tqc inner join t_quote_class_premium tqcm on tqc.class_code =tqcm. class_code where tqc.appid=pi. appid order by tqcm.premium_amt desc ) ......... From tables
I use the follwoing code to get a value from the SQL query. But now i would like to use some sql function like Sum() count() ... and i would like to get the result of that. vb Code: Dim constg As New SqlConnection constg.ConnectionString = "Data Source=m......." constg.Open() Dim payrollquery As String '= ("SELECT * FROM xxxxx.nnnnn WHERE ID IN(" & ID & " ) AND sent = 'U' ") Dim cmd3 As New SqlCommand(sqlstr, constg) Dim reader As SqlDataReader = cmd3.ExecuteReader
i need to make 2 funtions on an ASP.NET c# page working with an SQL server (using Visual Web Developer 2010 Express) the 1st one is a simple serach and i've done the 2nd thing is an update , the sp is like:(it works in SQL)
UPDATE [lens] SET [qty] = @b+@c WHERE [id] = @a
@a is the id which user input in the textbox1
@b is an number user input in the textbox2
now @c should be the result of an query "select [qty] from [lens] where [id] = @a"
so ,the new value of [qty] will be the "old valus"+"valus in textbox2"
I would like to get the list of users (from db) who meets my SQL select statement, and send email for each of them.my current looks like this
Code:
Dim constguser As New SqlConnection constguser.ConnectionString = ConfigurationManager.ConnectionStrings("xxxxxxxx").ToString Dim email1D, email2D, userNickName, userName, rc As String constguser.Open()
[code]....
If i run this code its only going to get the name and email of the first result found. I was wondering if there is a faster way to get all user result from the sql query, myb using a for loop?
New to Linq and Var type have a method where linq query is executed, want to return the result and assign it to GridView. but method don't take the return type as var.
So was wondering how do i return this query result?
Should i assign this result to DataTable first and make the method return type as DataTable?
Here is the code, This is what i want to do but not sure what is the right way
I want to populate a label with the employees name when they enter a badge number in the source page but im new to programming and don't know how to tackle this. The database connection has been established and it is successful. just an fyi this is for a time sheet application.
string Badge = "100000" + Request.Form["xBadgeTextBox"]; string Date = Request.Form["xWeekDropDownBox"]; string Hours = Request.Form["xWlengthDropDownBox"]; if (Badge != null) { string cmdquery = "SELECT EMPLOYEE_NAME FROM Employees WHERE Badge ='" + Badge + "'"; OracleCommand cmd = new OracleCommand(cmdquery); cmd.Connection = conn; cmd.CommandType = CommandType.Text; }