Monday, February 08, 2010
Thursday, February 04, 2010
sql how to replace the time value in datetime column
update Table1
SET StartDateTime = CONVERT(datetime,
CONVERT(VARCHAR(10),StartDateTime , 101)
+' '+CONVERT(VARCHAR,datepart(HH,NewStartTime))
+':'+CONVERT(VARCHAR,datepart(MI,NewStartTime))
+':'+CONVERT(VARCHAR,datepart(SS,NewStartTime))
+':'+CONVERT(VARCHAR,datepart(Ms,NewStartTime))
)
Posted by
SF
at
11:40 am
0
comments
Wednesday, February 03, 2010
replace time in datetime value c#
I have 2 datetime values: StartDateTime ('11/01/2010 00:00:00') and NewStartTime('12/02/2010 09:30:00 AM'). I want to replace the time value in StartDateTime with the time value in NewStartTime. In order to achieve so I go:
DateTime NewStartDateTime = new DateTime(StartDateTime.Year, StartDateTime.Month, StartDateTime.Day, NewStartTime.Hour, NewStartTime.Minute, NewStartTime.Second);
Posted by
SF
at
3:56 pm
0
comments
System.Web.HttpException: Request is not available in this context
this is caused by using "Request["xxx"]"
a quick fix is to use "HttpContext.Current.Request" instead
Posted by
SF
at
12:49 pm
0
comments
Wednesday, January 13, 2010
sql replace substring with value from associated table
Update TableA
set ColumnA1 = (select a.ColumnA from
(
"SELECT" REPLACE("t.ColumnA1, t.ColumnA2", (select "ColumnB1 from TableA where ColumnB2= t.ColumnA2))
FROM TableA t
) a
where TableA.ColumnA2 = a.ColumnA2)
GO
Posted by
SF
at
6:10 pm
0
comments
Wednesday, December 16, 2009
RadMenu hide menu item from server side
RadMenu1.FindItemByText("RadMenuItem1").Visible = false;
Posted by
SF
at
9:57 am
1 comments
Tuesday, December 15, 2009
determine whether radscheduler is in edit mode or insert mode
Edit Mode:
"if"(!RadScheduler1.StartEditingInAdvancedForm)
Insert Mode:
"if"(!RadScheduler1.StartInsertingInAdvancedForm)
Posted by
SF
at
2:50 pm
0
comments
Thursday, December 10, 2009
asp.net export to txt file receive error in IE when hosted in IIS6
code:
"Response".Clear();
"Response".AddHeader("content-disposition", "attachment;filename=" + FileName + ".txt");
"Response".Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
"Response".ContentType = "application/vnd.text";
"StringWriter" stringWrite = new StringWriter();
"HtmlTextWriter" htmlWrite = new HtmlTextWriter(stringWrite);
"Response".Write(strTXTFileBuilder.ToString());
"Response".End();
Error:
Internet Explorer cannot download file
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
My Solution:
Take out the line "
Posted by
SF
at
3:48 pm
0
comments
Wednesday, December 09, 2009
sql check existance before insert
'if' not 'exists' (select .... from .... where ....)
Begin
'Insert' Into ....... (..., ..., ...) values (..., ..., ...,)
END
Posted by
SF
at
2:26 pm
0
comments
Thursday, December 03, 2009
rebind parent page control on radwindow close
in the Parent page add into the radwinow aspx code:
sas"<"telerik:radwindow id="rwpopup111" title="popup111" runat="server" behaviors="Close" onclientclose="OnClientClose" navigateurl="popup111.aspx">
also add javascript:
function OnClientClose(oWnd)
{
//place your code to execute, see below for my examples, in this example I rebind a grid:
var hf111 = document.getElementById("");
var masterTable1 = $find("").get_masterTableView();
masterTable1.rebind();
var masterTable = $find("").get_masterTableView();
masterTable.rebind();
//after radwindow close you may lose title of the parent page, if that is the case reset it here:
document.title="abc";
}
Posted by
SF
at
12:29 pm
0
comments
Wednesday, October 28, 2009
RadWindow set size and more behaviors from code behind
rw.Width = Unit.Pixel(800);
rw.Height = Unit.Pixel(600);
rw.Behaviors = WindowBehaviors.Move & WindowBehaviors.Maximize & WindowBehaviors.Close;
Posted by
SF
at
3:21 pm
0
comments
SQL Server Reporting Services » how to add brackets around a value
question:
1. add brackets around a value
2. display or hide a string depending on a value. e.g. show "IDExists" in a textbox if Fields!ID != null, otherwise hide it
solution:
1. ="MemberID: (" & Fields!ID.Value &")"
2. =IIF (IsNothing(Fields!Id.Value), "","IdExist")
Posted by
SF
at
3:17 pm
0
comments
Friday, October 23, 2009
radwindow close window from code behind
http://www.telerik.com/help/aspnet/window/postbackandcloseonreload.html
Posted by
SF
at
4:01 pm
0
comments
Thursday, October 15, 2009
cater for sql apostrophe select condition in C#
Filter.Value = "LastName LIKE '" + tbLastNameFilter.Text.Trim().Replace("'", "''") + "%'";
Posted by
SF
at
3:53 pm
0
comments
Tuesday, October 13, 2009
How to remove duplicate rows from a table in SQL Server
http://support.microsoft.com/kb/139444
Posted by
SF
at
4:50 pm
0
comments
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine
http://blog.crowe.co.nz/archive/2007/04/16/728.aspx
http://geekswithblogs.net/wpeck/archive/2009/04/30/quotthe-microsoft.jet.oledb.4.0-provider-is-not-registered-on-the-local-machine.quot.aspx
http://www.telerik.com/support/kb/aspnet-ajax/general/error-on-64-bit-windows-machines-the-microsoft-jet-oledb-4-0-provider-is-not-registered-on-the-local-machine.aspx
Posted by
SF
at
10:08 am
0
comments
Turn Off “Saving Auto Recovery information” in Microsoft SQL Server Management Studio 2008
http://blog-mstechnology.blogspot.com/2009/06/turn-off-saving-auto-recovery.html
Posted by
SF
at
10:08 am
1 comments
All Sample Connection String for All database using C#.Net and VB.Net
found this one useful
http://www.dotnetspider.com/resources/28823-All-Sample-Connection-String-for-All-database.aspx
Posted by
SF
at
10:04 am
0
comments
Saturday, October 10, 2009
Visual Studio 2008 windows form making datagridview resizable runtime within a form
set the Anchor to (Top, Bottom)
Posted by
SF
at
3:40 am
0
comments
Saturday, October 03, 2009
datagridview checkbox column unable to fetch current row check status
need to use "datagridview1.EndEdit()" in "datagridview1_CellContentClick" event to finalize the editing of current row so that the changes made to the current row (in this case the change of check status) is submitted
Posted by
SF
at
1:01 am
0
comments