|
Continue it like this,
- Get the records from your database, using a
SELECT clause. - Save that response into a variable of type array (or a generic list).
Which language are you actually using? C#, Java, C++, PHP? It depends on which framework and language you're using. The language would allow you to perform such actions on the objects (or the list of the object) that is being returned.
Usually results from the database are in a form of an array or list.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
using Vb.net...am trying to achieve it but cant figure to do it
|
|
|
|
|
|
..and please stop shouting the subject.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
public void GetDatainArr()
{
string strSQl = "";
string[] Arr = new string[50];
strSQl = "select [Id] from [tblname] ";
DataTable dt = GetDataTable(strSQl);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
Arr[i] = Convert.ToString(dt.Rows[i][0]);
}
}
}
public DataTable GetDataTable(string Sql)
{
SqlConnection conn = new SqlConnection("ConnectionString ");
conn.Open();
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand(Sql, conn);
SqlDataAdapter ad = new SqlDataAdapter();
ad.Fill(dt);
conn.Close();
return dt;
}
This code in C# so you can Convert this code in vb using this link http://www.developerfusion.com/tools/convert/csharp-to-vb/
Sanket Gandhi
|
|
|
|
|
Hi,
I have an SSRS report when I do export to PDF some part of it is missing in the page and appearing in a new page, is there any way to set my report within margins even when we export it to PDF?
Any help any code snippet, link or even suggestion would be appreciated.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi All,
I have an rdl file as part of my solution, when I try to open it or edit it, it is opening in xml format, is there any way that I can open and edit this file, as I was working on Crystal Reports I was just able to open and make the header name changes, query changes and etc there itself and save the report that was reflecting there.
Is there anything similar here in SSRS because I want to edit the report and the xml format isn't much useful, any help like a code snippet, a link or suggestion would be greatly helpful.
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi
GO TO DATA SET -------->>> Rightclick------------>>>>>>> GO TO EDIT--------->>>> Whole QUERY You can change.
As per your requirement . You can change your reports.
|
|
|
|
|
Open it in Visual Studio with the MSSQL Business Intelligence addons - create a new report project and add the .rdl file
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Thanks buddies I got it.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
is it possible to create a view in mysql with ranking row?
I tried the following:
CREATE VIEW MYVIEW AS SELECT `SAdmNo`, `Average`, CASE WHEN @PREVRANK=`Average` THEN @CURRANK WHEN @PREVRANK :=`Average` THEN @CURRANK :=@CURRANK+1 END AS RANK FROM `total_termaverage_view`, (SELECT @CURRANK :=0,@PREVRANK :=NULL)R ORDER BY `Average` DESC ;
and got the following:#1351 - View's SELECT contains a variable or parameter
|
|
|
|
|
Does Google not work where you are?
First result of searching for "mysql ranking view":
Use:
SELECT t.id,
t.variety,
(SELECT COUNT(*) FROM TABLE WHERE id < t.id) +1 AS NUM
FROM TABLE t
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
that one doesnt work ...thats why i resorted to codeProject...
|
|
|
|
|
KipkoechE wrote: that one doesnt work Have a think about what would help us help you - phrases like 'that doesn't work' don't give us any useful information.
What helps us help you are - the query you ran together with any error messages you received
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
SELECT t.id,
t.variety,
(SELECT COUNT(*) FROM TABLE WHERE id < t.id) +1 AS NUM
FROM TABLE t;
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE WHERE id < t.id) +1 AS NUM
FROM TABLE t
LIMIT 0, 25' at line 3
|
|
|
|
|
I take it you have a table in your database called TABLE with the columns id and variety within it?
My initial guess is - probably not.
You will need to take what Richard has given you and adapt it to your table.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
So you copied the query from the StackOverflow answer verbatim, without making any effort to adapt it to your real table structure, and you expected it to work?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I created a table exactly the way it is for testing purposes before customizing to my needs
|
|
|
|
|
sorry...i had not understand the structure of the table...modified to :
create view vb as SELECT t.id, t.variety, (SELECT COUNT(*) FROM t WHERE id < t.id) +1 AS NUM FROM t t
Results:
id variety num
1 sss 1
2 sdsdssd 1
3 dfddd 1
need num to be : 1,2,3 instead of 1,1,1
-- modified 12-Feb-15 11:12am.
|
|
|
|
|
Your table aliases confused me and they may have confused MySQL too, try:
create view vb as SELECT t1.id, t1.variety, (SELECT COUNT(*) FROM t WHERE id < t1.id) +1 AS NUM FROM t t1
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
thanks so much for taking your time to kind me...God's Blessings. i Have learned a lot
|
|
|
|
|
Less of the 'God' please although I am grateful for the Blessings part
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
finally the ranking is on ascending order and need it to be in such a way that the highest marks/value takes position 1:
tried this:
create view View_Positioning as SELECT t1.`SAdmNo`, t1.`YearAdmitted`,t1.`TermAdmitted`,t1.`CLASSAdmitted` ,t1.`StreamAdmitted`,t1.`OutOfMarks`,t1.`ENGLISH`,t1.`KISWAHILI`,t1.`MATHEMATICS`,t1.`SCIENCE`,t1.`SSR`,t1.`Average`,(SELECT COUNT(*) FROM total_termaverage_view WHERE `Average` IS NOT NULL AND`Average` < t1.`Average`) +1 AS Position FROM total_termaverage_view t1 order by Average ASC ;
which gives:
Average position
324 1
345 2
|
|
|
|
|
Hi guys I have problem i need to make ERD relation entity
between employee and allowance
Employee table
Name
address
Basic Salary
Bonus
Allowance table
House rent
Food Allowance
Moving Allowance
Basic Salary is monthly and fixed
Bonus is monthly and fixed
food allowance is monthly and fixed for married employee
House rent is monthly and fixed for some employee and some employee take house rent two time in year every 6 month
every employee married take 3 months salary from basic salary in year
suppose i m married and i take basic salary 5000
i will take rent 5000 x 3=15000/12=1250 monthly
some employee take rent every half year meaning every 6 month
meaning 15000/2=7500
My question according to my case above
Which is best put allowance in table allowance or put allowance(food,housing,moving)
in employee table and what relation between two tables
|
|
|
|
|
Some things to consider in your design ...
How about a design like this:
employee Key
Allowance Code
Effective_Start_Date
Effective_End_Date
Allowance Rate
This may not be complete, but what it does for you is that it allows for many types of allowance codes to be associated with an employee, each allowance code has an effective date range with an associated rate. This also allows for 2 employee who have the same allowance code to be compensated differently.
You would then need another table which translates the Allowance Code to a description.
I use a similar approach when dealing with prices, you have the history of the prices over time ...
Just a thought.
Good luck. 
|
|
|
|