|
Hi All,
I need to write a query where I have to search Date form DB.
Suppose I have a column name as InvoiceDate and I have to search all the records whose InvoiceDate is Like 02/14 or 02 or 02/14/2007.These are the different searches which I need to do.
Please help me...
Thanks in advance...
|
|
|
|
|
How you are storing date values in database ? Varchar or datatime ?
If varchar then
select * from table where InvoiceDate like '02/14'
select * from table where InvoiceDate like '02'
select * from table where InvoiceDate like '02/14/2007'
if datetime use day,month and year functions to search like this
|
|
|
|
|
Thanks for the reply.I storing it as datetime.Can u please explain me in detail or help me in writting the code.
Thanks ...
|
|
|
|
|
It could be something like
--For checking day
select * from table where day( convert(datetime,yourdatetimecolumn) ) = yourday
--For checking day and month
select * from table where month( convert(datetime,yourdatetimecolumn) ) = yourmonth and day( convert(datetime,yourdatetimecolumn) ) = yourday
select * from table where convert(datetime,yourdatetimecolumn) = yourdate
I am not sure that this is the best way. But I think it can work according to u r requirement.
|
|
|
|
|
The input can be anything I mean if user put 2/ then how will I use this...
|
|
|
|
|
varshavmane wrote: The input can be anything I mean if user put 2/ then how will I use this...
You should ensure that the input is valid. If not valid like 2/ change it to the format which we can do checking
|
|
|
|
|
if i want to design a Report then which one we will choose.
aspx page or CrystalReport(.rpt) if CrystalReport then how will do that?
Suppose, if I enter a Empno and Date in TextBoxes then Report should display task details for that day for the given Empno?
pls tell me ,Can we add any labels and TextBoxes in CrystalReport(.rpt)
Thanks to all Repliers
|
|
|
|
|
siddisagar wrote: f i want to design a Report then which one we will choose.
aspx page or CrystalReport(.rpt) if CrystalReport then how will do that?
It depends on your requirement. If you want only showing the output to user then better go for aspx page. Or if u wan to convert the output to PDF then crystal reports will be good solution.
siddisagar wrote: Can we add any labels and TextBoxes in CrystalReport(.rpt)
Labels you can. Textboxes I am not sure
|
|
|
|
|
I need to populate a listbox named "subcategory" once the user clicks his desired selection in dropdownlist named "category" e.g. c++ has subcategories polymorphism,inheritance etc.
please help me thru code
|
|
|
|
|
manugrg wrote: I need to populate a listbox named "subcategory" once the user clicks his desired selection in dropdownlist named "category"
In server side you can do like this
1. Make autopostback to true for category dropdown
2. On selected index changed event of category write the following code
if( category.SelectedItem.Text == "c++" )
{
subcategory.items.add("polymorphism");
subcategory.items.add("overloading");
subcategory.items.add("something");
}
But this method will make a postback each time when you change category. For avoiding postback use javascript
|
|
|
|
|
Try this:
strSql = "SELECT ID , Name FROM sysTable"
objDT = objDB.ExecuteDatatable(strSql)
If objDT.Rows.Count > 0 Then
With cmb
.DataSource = objDT
.DataTextField = objDT.Columns(1).ToString
.DataValueField = objDT.Columns(0).ToString
.DataBind()
If IsDefaultValueNeeded Then
.Items.Insert(0, New ListItem("Select", -1))
End If
End With
End If
On SelectedIndexChanged of combo Fill the listbox
strSql = "Ur Query"
objDT = objDB.ExecuteDatatable(strSql)
If objDT.Rows.Count > 0 Then
'Fill ListBox With Column Display Name
With lstsource
.DataSource = objDT
.DataTextField = objDT.Columns(3).ToString
.DataValueField = objDT.Columns(0).ToString
.DataBind()
End With
Endif
hope this helps u...
|
|
|
|
|
how to connect a string array fileList in the gridview .i am doing it as
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("title", typeof(String));
DataRow newRow;
foreach (DataRow row in fileList)//???<u>i am not getting how to do this </u> {
newRow = dt.NewRow();
newRow["title"] = Title;
dt.Rows.Add(newRow);
}
GridView1.DataSource =dt.DefaultView ;
GridView1.DataBind();
}
GridView1.AutoGenerateColumns = false;
GridView1.DataBind();
on aspx page
<asp:GridView ID="GridView1" AutoGenerateColumns="true" runat="server" ShowHeader="False" GridLines="None" OnRowCommand="GridView1_OnRowCommand" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="Hyperlinkpolicy" runat="server" Text='<%#Eval("fileList") %>' CommandArgument='<%#Eval("fileList") %>' CommandName="button" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
pls help me out .
thanks in advance
-- modified at 2:24 Thursday 15th March, 2007
thanks in advance .
|
|
|
|
|
i have parent.aspx and child.aspx pages,child.aspx ia a modal dialoug box.when i click a link on parent.aspx page child.aspx will open. if i close child.aspx ,parent.aspx will refresh..upto this it working well..
if i again click on the same link the child.aspx page show the old data..the page load is not working.
if i click another unclicked link..the page load work..
so for a link in parent.aspx only one time the page load work in child.aspx
how can i solv it?
thks
yesu
|
|
|
|
|
ypki wrote: if i again click on the same link the child.aspx page show the old data
Browsers cache is making problem. Next time it is showing from browsers cache. To avoid set the browsers cachebality to none in child.aspx
|
|
|
|
|
Dear all,
i am making web application using asp.net2.0,C#,sql2000
i generated report in local mode that say report.rdlc.
my question is can i print this report. if yes please give some usefull link or example
thanks
regards
imran khan
|
|
|
|
|
Do you want to print the contents in the browser ? Then use document.print() in javascript
|
|
|
|
|
Hi All,
My question is that if any one has a module or function that encrypts and then decrypts specific data of any type. I have a case where i want to save data encrypted in sql 2005 and then show it decrypted for specific users only. I am using asp.net 2.0 and sql 2005
Any help is really appreciated and thanks in advance.
|
|
|
|
|
samerh wrote: I have a case where i want to save data encrypted in sql 2005 and then show it decrypted for specific users only
In SQL 2005 you can use symmetric encryption to encrypt and store data. For that check this article[^]
To encrypt from code behind and store in database check this
www.codeproject.com/aspnet/encrypt.asp[^]
|
|
|
|
|
i want whether check box is checked or not at client sied
check box is in grid column help me
|
|
|
|
|
Hi
Check this example, if this is not clear, please do reply..
<script language="javascript" type="text/javascript">
function CheckBoxFunction()
{
var el=document.form1.elements;
for(x=0;x<el.length;x++)
{
if(el[x].type=="checkbox")
{
if(el[x].id.indexOf("CheckBoxIDofGrid") != -1)
{
if(el[x].checked == true)
{
}
}
}
}
}
</script>
Harini
|
|
|
|
|
Thnaks for reply
i am not geting //Take ClientID (ie. GridView_101_CheckBoxID) of CheckBox and do the process based on this ID. whats this
grdJobSynchReq my grid id and i am addung check boxes at run time with CheckBox1 id
|
|
|
|
|
|
Hi i have intime(08:45) and outtime(20:16) => 24 hours format...,
Now i want to calculate between the time,
how many hours and minutes like...,
Plz help me,i need that codes.........,
Regards,
Magi
|
|
|
|
|
Hi,
take two strings for intime(in) and outtime(out). and write code for diff
DateDiff(DateInterval.Minute, in, out)
U will get diff in miutes.
|
|
|
|
|
Hi datediff its not working for this probs,
see i have intime and outtime in string fromat,
means in this format "08:58" and "19:45" like,
now i want hours and minutes both in string format like.....,
The output will look like this format,"10:47"
Plz help me.......,
regards,
Magi
|
|
|
|