tsql where clause checking even or odd number
update student
set isOdd = 1, isEven = 0
where exammark % 2 =1
Achievement provides the only real pleasure in life
update student
set isOdd = 1, isEven = 0
where exammark % 2 =1
Posted by
SF
at
1:54 am
0
comments
return Redirect(Request.UrlReferrer.ToString());
Posted by
SF
at
12:14 am
0
comments
make sure the form declaration in the view has all necessary attributes, e.g.
Posted by
SF
at
5:26 pm
0
comments
http://jsfiddle.net/r77K8/1/
Posted by
SF
at
5:25 pm
0
comments
public void UploadProductImage(HttpPostedFileBase file)
{
string subPath = "~/Images/";
bool isExists = System.IO.Directory.Exists(Server.MapPath(subPath));
if (!isExists)
{
System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
}
if (file != null)
{
string pic = System.IO.Path.GetFileName(file.FileName);
string path = System.IO.Path.Combine(Server.MapPath(subPath), pic);
file.SaveAs(path);
UploadProductImageThumbnail(file, productId);
}
}
public void UploadProductImageThumbnail(HttpPostedFileBase file)
{
using (var image = Image.FromStream(file.InputStream, true, true))
{
var thumbWidth = 50;
var thumbHeight = 50;
using (var thumb = image.GetThumbnailImage(
thumbWidth,
thumbHeight,
() => false,
IntPtr.Zero))
{
var jpgInfo = ImageCodecInfo.GetImageEncoders()
.Where(codecInfo => codecInfo.MimeType == "image/jpeg").First();
using (var encParams = new EncoderParameters(1))
{
string thumbPath = "~/Images/Thumbnails";
bool isExists = System.IO.Directory.Exists(Server.MapPath(thumbPath));
if (!isExists)
{
System.IO.Directory.CreateDirectory(Server.MapPath(thumbPath));
}
var thumbPathFull = Path.Combine(Server.MapPath(thumbPath), file.FileName);
long quality = 100;
encParams.Param[0] = new EncoderParameter(Encoder.Quality, quality);
thumb.Save(thumbPathFull, jpgInfo, encParams);
}
}
}
}
Posted by
SF
at
5:28 pm
0
comments
products = products.Where(p => SqlFunctions.StringConvert((double)p.ProductId).Trim() == searchString);
Posted by
SF
at
12:10 am
0
comments
protected void RadGrid1_DataBound(object sender, eventargs e)
{
GridItem commandItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
Button button1 = commandItem.FindControl("button1") as Button;
}
Posted by
SF
at
12:57 pm
0
comments
string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
Posted by
SF
at
12:08 pm
0
comments
alternative is to use plain javascript, doesn't behave as nice but it works.
function toggleCourseDescriptions(conditioner) {
var targetCtrl = document.getElementById("divCourseDescription");
var triggerControl = document.getElementById("aToggleCourseDescription");
if (targetCtrl.style.display == 'none') {
targetCtrl.style.display = null;
} else {
targetCtrl.style.display = 'none';
}
if (triggerControl.text == "-") {
triggerControl.text = "+";
} else {
triggerControl.text = "-";
}
}
Posted by
Unknown
at
5:33 pm
0
comments
((int)(((decimal)(a.Category.Sum(l => l.Quantity) : 0) / MyDividerInteger) * 100)).ToString() + "%",
Posted by
Unknown
at
11:40 pm
0
comments
MenuItem item = menu.FindName("ContextMenuItemToggleReporting") as MenuItem;// .Single(i=>((MenuItem)item).Name == "ContextMenuItemToggleReporting") as MenuItem;
if ([you condition logic here. e.g. MyEntity.IsReportingEnabled])
{
item.Header = "Disable Reporting";
}
else
{
item.Header = "Enable Reporting";
}
Posted by
Unknown
at
11:12 pm
0
comments
Posted by
Unknown
at
12:33 pm
0
comments
I have a relative layout with a scrollview and a AdMob in it. The AdMob on the bottom overlaps the the scrollview so that the bottom part of the scrollview can never be seen. After a lot of trial and error I found that the solution is simple: set the ScrollView to android:layout_above="@+id/adView".
So the layout structure is something like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView_home"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/adView"
android:layout_alignParentTop="true"
android:background="@drawable/background"
android:orientation="vertical" >
.....
.....
.....
</ScrollView>
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="abcdefg"
ads:loadAdOnCreate="true" />
</RelativeLayout>
Posted by
Unknown
at
1:08 am
0
comments
Posted by
Unknown
at
12:25 am
0
comments
use COLLATE NOCASE
e.g. db.query("mytable", new String[]{.....}, "productname = '" + value + "' COLLATE NOCASE", null, null, null, null);
Posted by
Unknown
at
11:41 pm
0
comments
This is rather wierd, when you want to assign an integer to a TextView apparently you need to assign the combination of "" + and your integer value.
Posted by
SF
at
1:54 am
0
comments
I have an asp.net webforms application with later on added mvc component. The login view is embeded inside the homepage Default.aspx. When I type into browser and try to open a login controlled URL without loggged in, i should be redirected to the Default.aspx homepage for login, but instead I get 404 not found error looking for "/Account/Login".
The solution worked for me is rather wierd:
add the following setting in AppSettings section of your web.config
Posted by
SF
at
1:16 pm
0
comments
if (!page.ispostback)
{
RadGrid1.MasterTableView.FilterExpression = "([Country] LIKE \'%Germany%\') "; GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("Country"); column.CurrentFilterFunction = GridKnownFunction.Contains; column.CurrentFilterValue = "Germany"; RadGrid1.MasterTableView.Rebind();
}
Posted by
SF
at
4:06 pm
0
comments
EXEC sp_MSforeachdb 'USE ?
select ''?'' as DatabaseName, st.name as TableName,si.name as IndexName from sys.indexes si
inner join sys.tables st
on
si.object_id = st.object_id
where si.name like ''%NC_explore_user%'''
Posted by
SF
at
4:22 pm
0
comments