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 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 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 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; }
I have the following code which writes to a Gridview:
[Code]....
Using the same methods of connecting to the database, how can I amend this code to write the result of a second query (which only returns a number) to a label?
var result = from category in myEntities.Categories where category.UserId == userId orderby category.CategoryName select category;
What is the type of "result"? I casted it to an IQueryable variable and it worked except it did not have some of the methods normally available, e.g. Count(). In my program I have to cast it to some explicit types and then use the Count() method.
I am running a LINQ query which populates a list used by a DropDownList, I need to insert an "Unassigned" value to the list. The function below queries the values correctly from the db but does not insert the "Unaasinged" value to the list.
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'