|
Hi i am using one stored procedure...,
i am passing month value and year value to that procedure...,
So i am getting a month all dates...,
Its i checked with query analyzer...,
Now my question is,
I try to display those dates in my datagrid...,
So i have created one boundcolumn, in that i try to display those dates...,
But its displaying first date only...,
Becoz each and every loop its creating the date name as startdate...,
How to solve this probs...,
This is my stored procedure:
CREATE PROCEDURE datetesting
(
@months as tinyint,
@years as smallint
)
As
DECLARE
@startDate datetime,
@nextdate datetime,
@endDate datetime
begin
SET @startDate = CAST( CAST(@years AS varchar(4) ) + '0101' AS datetime )
SET @startDate = DATEADD( m, @months - 1, @startDate )
set @enddate=dateadd(m,1,@startdate)
set @enddate=dateadd(d,-1,@enddate)
select @startdate as startdate
if @startdate < @enddate
begin
SET @nextdate = DATEADD( d, 0, @startdate )
set @startdate=dateadd(d,1,@nextdate)
select @startdate as startdate
end
Advance thanks,
end
GO
Regards,
Magi
|
|
|
|
|
You need to use SQL Server temporary tables. Store your results into a temporary table and select that table at the end of procedure.
|
|
|
|
|
No i am getting all dates in query analyzer in this format:
startdate
2007-06-01
startdate
2007-06-02
.
.
startdate
2007-06-30
means its displaying like separate separate table...,
So how to merge the datas?,
and how to store it in temporary table?,
and how to retrive it from that tenporary table?,
If data's will come the following format then i will get proper answer..,
Startdate
2007-06-01
2007-06-01
.
.
2007-06-30
Regards,
Magi
Regards,
Magi
|
|
|
|
|
You could change your procedure something like this (Not exactly, may be you need to change something in this to work it out for your requirement).
CREATE PROCEDURE datetesting
(
@months as tinyint,
@years as smallint
)
As
DECLARE
@startDate datetime,
@nextdate datetime,
@endDate datetime
create table #temp(startdate datetime)
begin
SET @startDate = CAST( CAST(@years AS varchar(4) ) + '0101' AS datetime )
SET @startDate = DATEADD( m, @months - 1, @startDate )
set @enddate=dateadd(m,1,@startdate)
set @enddate=dateadd(d,-1,@enddate)
insert into #temp
select @startdate as startdate
if @startdate < @enddate
begin
SET @nextdate = DATEADD( d, 0, @startdate )
set @startdate=dateadd(d,1,@nextdate)
insert into #temp
select @startdate as startdate
end
select * from #temp
drop table #temp
|
|
|
|
|
Hi now i am getting first two dates only...,
Becoz, when i am exec that procedure...,
the values going to if condition...,
there its creating 29 tables...,
each date in separate separate table...,
So if we give #temp its binding only first 2 dates
How to solve that probs...,
see,when i am exec that procedure i am getting output like this,
startdate 'one table
2007-06-01
startdate 'second table
2007-06-02
.
.
startdate 'last table
2007-06-30
means its displaying like separate separate table...,
So how to merge the datas?,
and how to store it in temporary table?,
and how to retrive it from that tenporary table?,
Regards,
Magi
|
|
|
|
|
<br />
EXEC datetesting 1,2007<br />
Are you sure that the sp works fine?? I think ur sp return only first date.
|
|
|
|
|
No i am getting all dates in query analyzer in this format:
startdate
2007-06-01
startdate
2007-06-02
.
.
startdate
2007-06-30
But if it will come the following format then i will get proper answer..,
Startdate
2007-06-01
2007-06-01
.
.
2007-06-30
Regards,
Magi
|
|
|
|
|
can we stop the postback of (page(aspx) or div) through javascript
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
Could you please tell us the example why you wanna do like that?
Normally, if you dont wanna have the postback in your page, you can use HTML controls in your page or avoid "Form.Submit()" function.
|
|
|
|
|
i using div (scroll bar) for chat window.and chat window text retrieve from hash table and hash table refresh by ajax timer(in 1 sec.) so page alwas post back so i cnt manage scroll bar freely plz help
Piyush Vardhan Singh
Programmer
TAS NewDelhi
India
9313077379
|
|
|
|
|
In javascript function use return false; . Call your javascript function like return Function(); . This will stop posting the form
|
|
|
|
|
I've a comobbox and i'm fill this comobbox like this:
===========================================================================================
oleDbDataAdapter1.Fill(dataSet31);
dpdhead.DataSource = dataSet31.Tables[0].DefaultView;
dpdhead.DataTextField = dataSet31.tbacdes.ac_headColumn.ToString();//Display Heads
dpdhead.DataValueField = dataSet31.tbacdes.ac_idColumn.ToString();// Heads Ids
dpdhead.DataBind();
===========================================================================================
and than i want to get Comobbox select item head id. But when i select the comobbox value page refresh, first time it return head id but when i again select a value i got an javascript error like this:
====================================
Error: Invaild Syntax
Code: 0
====================================
And comobox stop working. and page doesn't work.
Please help me out in this matter (Urgent)
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
|
hi!!!!
i have a project on dicussion forums... first i gave options like good,bad and worst for rating if the user select an option it is stored in database. now i have a problem in Displaying the rating..how to bind the data to the label now..
Advance thanx 2 helpers..
harika
|
|
|
|
|
I am not getting what is the problem you are facing when binding the data ? Please be more specific to your problem
|
|
|
|
|
in my raing forum i took a button rate when ever i clicked on that... this z the following code in that...
if (Page.IsPostBack)
{
string x;
x = rbtnRating.SelectedItem.ToString();
if (x != "")
{
switch (x)
{
case "Excellent":
strRate = "5";
break;
case "Good":
strRate = "4";
break;
case "Average":
strRate = "3";
break;
case "Bad":
strRate = "2";
break;
case "Terrible":
strRate = "1";
break;
}
btnRate.Enabled = false;
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["KMSConnectionString"]);
con.Open();
string str = "insert into Rating(Rate,Authorname,Replies,QId) values('" + strRate + "','" + btnName.Text + "','" + lblReply.Text + "' ,'" + btnSno.Text + "' )";
//string strT="count
SqlCommand cmd = new SqlCommand(str, con);
DataSet ds = new DataSet();
cmd.ExecuteNonQuery();
con.Close();
now the problem is how can i retrive the data to label like is the user gets 5 points i want to calculate the total replies rated.....how to bind this to my label.
harika
|
|
|
|
|
Normal rating will be calculated for a message will be like taking the average of score. So you need to calculate the average with total users rated and score. Then show this to label. To make the calculations more easier, use stored procedures. If you are using a normal query, you need to get the results into some datatable and then do the calculations. Stored procedures allows you to do all these calculations inside it.
|
|
|
|
|
hi,
I want to generate <TD>'s at runtime depending upon the records returned by a stored procedure.I am creating layers using <Div> tags in my aspx page.How do i do it?
My code is as below:
<!-- DROP DOWN MENU --><a name="2"></a>
<script language="JavaScript" type="text/javascript">
document.write("<div id=\"menu2\" style=\"filter:revealTrans(duration=.5, transition=3) progid:DXImageTransform.Microsoft.Shadow(direction=135, color=#AAAAAA, strength=5);\" onmouseout=\"killMenu('menu2')\" onmouseover=\"checkMenu();\">");
document.write("<layer name=\"menu2\" onmouseout=\"killMenu('menu2')\" onmouseover=\"checkMenu();\">");
</script>
<TABLE cellSpacing="0" cellPadding="0" width="150" border="0">
<tr>
<td vAlign="top"><A class="menulink1" href="javascript:ViewSettings();">User Settings </A>
<A class="menulink1" href="javascript:ViewSignature();">Signature </A><A class="menulink1" href="javascript:ViewDistributionList();">
Define Distribution List </A><A class="menulink1" href="javascript:ViewFolderManager();">
Folder Manager </A>
</td>
</tr>
</TABLE>
<script language="JavaScript" type="text/javascript">document.write("<\/layer><\/div>");</script>
<!-- END DROP DOWN MENU -->
Here <A class="menulink1" href="">Record1 </A> will be generated depending on the number of records fetched from the database.
For e.g. If 5 records are returned then 5 <A href ></A> tags shld be generated.
plz let me knw how to do it?
Thanks,
Riz
|
|
|
|
|
|
Hi frndz,
How are you all???
I am using MSasp.net 1.0 .I would like to know ,how we can send SMS to a mobile phone from my application??
I think some service access like... needs from connection providers and wat about the programming side??
any help is appreciatable....
Thank you
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
You could get some webservice from the mobile service providers. Use that to send SMS.
|
|
|
|
|
Hi,
I have a datatable called dtEmployeeData. In the datatable the Employee's name can sometimes be in there more then once(I get this data from a sql database). Now I can't change my select query, to bring back the employee name only once, as the his name is allowed to be in the gridview more then once(due to transaction history).
What I want to do now is, is to select only the name from that datatable, and only show his name once in a dropdownlist. I use this dropdownlist to show all the employee names, and the name must only appear once. How would I do this?
Here is my code I have so far:
<br />
Dim dtEmployeeData As DataTable = New DataTable()<br />
dtEmployeeData = BO.getData()<br />
<br />
drpSort.DataValueField = "EmployeeName"<br />
drpSort.DataTextField = "EmployeeName"<br />
<br />
drpSort.DataSource = dtEmployeeData<br />
Using this code, I get:
Abraham
Bennie
John
John
John
Peter
Stewart
I want to have the following:
Abraham
Bennie
John
Peter
Stewart
|
|
|
|
|
Hi, i think u can add some constraint to this datatable...here u can use UNIQUE constarint to employee name.....
Please search for Adding constarint to a datatable.. i hope that ll help u.
happy programming
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Use DISTINCT statement in your SELECT query.
Eg:
SELECT DISTINCT emp_name FROM emp_master
The above query would give you the unique names.
|
|
|
|
|
Hi Venkatesh,
I need to select from a datatable, not the sql database. I need to do something like a groupBy in the datatable, on a certain column. Any idea how to do that?
|
|
|
|
|