How to get the Query values? [closed] - sql-server

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
SqlDatasource1 :
Table1
-----------
Result_1
-----------
Result_2
I have a query, and I want to get a Result_2 value from the query in code behind, in the BeforePrint event, and I don´t want to put a label in the report, how can I do this?
Thanks

If you want to manually run the Select command on your data source, you could try something like (C#):
var dv = new DataView()
dv = Sqldatasource1.Select(DataSourceSelectArguements.Empty) as DataView;
if (dv.Count > 0)
{
foreach (DataRowView rv in dv)
{
string Result2Val = rv["Result_2"].ToString();
// do something with the result...
}
}
I'm sure VB will follow a similar pattern.
Alternatively, try and capture the OnSelected event, if it's already being triggered by another control.

Related

Unable to create database in Codeql [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I'm trying to create a database in Codeql but I'm unable to do it.
My input project is a simple hello.c in "/home/puya/Desktop/test" directory, and its source code is:
#include<stdio.h>
int main(void) {
printf("HELLO World!");
return 0;
}
and my command to create database is:
./codeql database create /home/puya/Desktop/database --language=cpp --source-root /home/puya/Desktop/test
and the output is:
enter image description here
enter image description here
Can anyone help me?

Calculating monthly salary returned NaN in React [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
I am writing a code which calculate monthly net salary in react but I faced issue NaN. What is my error in this code: ?
There seems to be one of the reason why you are getting NaN is because you have not initialized netSalary, grossSalary and other variables and as a result they are undefined and when you do something like undefined + 1 => you get NaN.
But why are they undefined?
You might think in your function you updated the state variables before using them, but they are not updated instantaneously not synchronously, so after you have written setTaxRates() and if you try to use the state variables at that moment the state variable have not really updated it's value, so you will end up using old value, which will be undefined in this case.
Solution?
First initialize the state variables with some default data.
then in your funciton make sure you do not use state variables just after updating them
so your updated code will look something like this.
const salary()=>{
const [grossSalary,setGross] = useState(0);
const [taxRate, setTax] =useState(0);
const [pension, setPension] = useState(0);
const [netSalary, setNet] = useState(0)
const calSal =()=>{
if(grossSalary > 600 && grossSalary<1651){
let taxR = (grossSalary*0.1)-60;
let penS= grossSalary*0.7
netSal = grossSalary-taxR-pension;
// now update all the states as required
setTaxRate(taxR);
setPension(penS);
setNetSalary(netSal);
}else{
.......
}
.............
}
}

How to use variables in django url path? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am developing and Django website, and I have an array of some str values(parts of url).When user is redirect to:
https://www.example.com/something/name/
how can system system knows that that is part of that arry.
I alredy have this:
urlpatterns = [
path(r'<name1>, views.example')
]
And Array:
arr = [name1,name2,name3, ....namen] # elements of array are assigned to variables in for loop.
Thank you in advance.
So you need to change urlpatterns to:
path('<str:name>,views.example)
str is data type, and other data type for this use are:
int – Matches zero or any positive integer.
str – Matches any non-empty string, excluding the path separator(‘/’).
slug – Matches any slug string, i.e. a string consisting of alphabets, digits, hyphen and under score.
uuid – Matches a UUID(universal unique identifier).
And function call to:
views.example(request, name = "name_n") # for better code reading use name_1, name_2, .. name_n instead of name1,name2 etc.
and that would be it, enjoy in Django.

Covert array date string and decrease 3 hours in Shell Script [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I need from an array decrease 3 hours from it and print in command line again
the output of the array is:
12:29:14
14:10:26
14:30:34
14:35:31
14:35:10
11:57:03
12:49:31
12:57:09
11:04:49
13:06:57
14:35:34
14:30:49
14:34:28
12:58:02
14:28:12
12:29:18
11:33:23
12:27:04
14:35:43
12:58:46
I am trying with this line, but no use.
date2=$(date -d "${array[#]}" "3 hour ago" +"%H:%M:%S")
Could you please help me about it?
try this;
#!/bin/bash
times=( "12:29:14" "14:10:26" "14:30:34" "14:35:31" "14:35:10" "11:57:03" "12:49:31" "12:57:09" "11:04:49" "13:06:57" "14:35:34" "14:30:49" "14:34:28" "12:58:02" "14:28:12" "12:29:18" "11:33:23" "12:27:04" "14:35:43" "12:58:46")
for dateItem in ${times[#]}
do
date2=$(date --date="$dateItem 3 hour ago" +%H:%M:%S)
echo $date2
done
Hi It's worked after doing some changes it works correct,
If you wish todo it without an array
Here it is:
date2=$(date -d "$times 3 hour ago" +"%H:%M:%S")
echo $date2

Can I use while(strstr(name[a],sname)!=NULL) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm writing a phonebook application and one of the functions is for searching the phonebook by name.
The program should print out the names the same way as the user entered them (later I will include the numbers and other info). The phonebook has 100 contacts.
sname is the name that user have entered to search.
name[a] is name list. Is there any other code like strstr? Like its operating if its found printing them if not then print("not found any") something like this:
for(a=1; a<101; a++) {
while(strstr(name[a],sname) != NULL) {
printf(strstr(name[a], sname));
}
}
You can do that: it is an infinite loop.
while(strstr(name[a],sname)!=NULL){
printf("%s\n",strstr(name[a],sname));
}
None of a, name[a], sname change in the conditions or body of the while

Resources