This is my Technical area of troubleshooting and learning new Programming skills and many more. Here you will find answers for many new technologies like asp.net 2.0/3.5,4.0 C# access, mysql, Amazon Webservice ,Sql-server, JD Edwards, SAS, Salesforce, APIs, MVC and many more. please visit & discuss.
Thursday, December 30, 2010
Google Maps Control C# pin
Wednesday, December 29, 2010
Update,Delete in a table - SQL injection free C# .net
Update,Delete in a table - SQL injection free C# .net
void updateADJ()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "update BOINVADJ set IAMEDQTY1=@IAMEDQTY1,IAMEDQTY2=@IAMEDQTY2,"
+ " IABOXQTY=@IABOXQTY,IAGELQTY=@IAGELQTY,IACRYQTY=@IACRYQTY "
+ " WHERE IAID =" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.Parameters.AddWithValue("@IAMEDQTY1",TextBox2.Text );
cmd.Parameters.AddWithValue("@IAMEDQTY2", TextBox3.Text);
cmd.Parameters.AddWithValue("@IABOXQTY", TextBox4.Text);
cmd.Parameters.AddWithValue("@IAGELQTY", TextBox5.Text);
cmd.Parameters.AddWithValue("@IACRYQTY", TextBox6.Text);
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
void Deletedata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
string strSQL;
strSQL = "delete from BOINVADJ WHERE IAID=" + Request["ID"];
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Response.Redirect("invadj.aspx");
}
Monday, December 27, 2010
Change Row color in gridview C#
Sunday, December 26, 2010
AJAX Extender Control with Pop-up Window
Prepare web.config for HTML5 and CSS3
HTML5 and CSS3 introduces some new file types that enables us to create even better websites. We are now able to embed video, audio and custom fonts natively to any web page. Some of these file types are relatively new and not supported by the IIS web server by default. It’s file types like .m4v, .webm and .woff.
http://madskristensen.net/post/Prepare-webconfig-for-HTML5-and-CSS3.aspx
Tuesday, December 21, 2010
Monday, December 20, 2010
WCF Business Domain - Parent & Child Relationships
WCF by Example - Chapter XIII - Business Domain - Parent & Child Relationships - CodeProject
http://www.codeproject.com/KB/architecture/wcfbyexample_chapter13.aspx
Saturday, December 18, 2010
Creating a HTML5 video player control ,asp.net c#
This tutorial will introduce you to the process of ASP.NET server control development. You’ll also see how creating your own controls can simultaneously improve the quality of your Web applications, make you more productive and improve your user interfaces.
ASP.NET custom controls are more flexible than user controls. We can create a custom control that inherits from another server-side control and then extend that control. We can also share a custom control among projects. Typically, we will create our custom control in a web custom control library that is compiled separately from our web application. As a result, we can add that library to any project in order to use our custom control in that project.
ASP.NET 4.0 using Visual Studio 2010 deployment Package/Publish Web tool
There's many ASP.NET developers using Visual Studio who need flexible options and would like a UI to manage deployment tasks. These developers tend to deploy web applications themselves and a few deployment scenarios that exist today where you'll see those developers deploying applications themselves:
- Small to mid-sized companies where the developer sees the application end to end, often a solo developer, however s/he might be on a small team.
- Individual consultants or small consultancies that need to deploy remotely, often using FTP or FTPS (secure FTP).
- Small to mid-sized teams that don't have automated deployment or CI in place and are in charge of their own application deployments.
The central theme is that all three types of teams are all responsible for their own application deployments. If you work in a dev shop similar to one of these, you'll find Visual Studio 2010's Web Deploy feature is quite handy and should meet most of your deployment needs out of the box. But it's also easily extensible to get those few unique deployment tasks you may have configured and ready to go.
http://rachelappel.com/deployment/making-asp-net-deployment-easy-with-the-package-publish-web-tool/
Thursday, December 16, 2010
Send Email GridView as an Excel attachment C#, asp.net
Following is the complete code for Send Email GridView data as an Excel attachment, any question please post comment.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="AccessNo" HeaderText="AccessNo"
SortExpression="AccessNo" />
<asp:BoundField DataField="SerialNo" HeaderText="SerialNo"
SortExpression="SerialNo" />
<asp:BoundField DataField="ActivationDate" HeaderText="ActivationDate"
SortExpression="ActivationDate" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />
<asp:BoundField DataField="StatusDate" HeaderText="StatusDate"
SortExpression="StatusDate" />
<asp:BoundField DataField="OrderType" HeaderText="OrderType"
SortExpression="OrderType" />
<asp:BoundField DataField="OrderNo" HeaderText="OrderNo"
SortExpression="OrderNo" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:JDE_RKConnectionString %>"
SelectCommand="SELECT top 10 [AccessNo], [SerialNo], [ActivationDate], [Status], [StatusDate], [OrderType], [OrderNo] FROM jde_rk.dbo.a276185">
</asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.IO;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
sndmailattch();
}
void sndmailattch()
{
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
MailMessage mail = new MailMessage();
mail.IsBodyHtml = true;
mail.To.Add(new MailAddress("rajeevk@visli.net"));
mail.Subject = "Inventory Report";
System.Text.Encoding enc = System.Text.Encoding.ASCII;
byte[] myByteArray = enc.GetBytes(sw.ToString());
System.IO.MemoryStream memAtt = new System.IO.MemoryStream(myByteArray, false);
mail.Attachments.Add(new Attachment(memAtt,"inventory.xls"));
mail.Body = "Inventory report brother..";
SmtpClient smtp = new SmtpClient();
mail.From = new MailAddress("rajeevk@visli.net", "Rajeev Kumar");
smtp.Host = "mail.visli.net";
//smtp.UseDefaultCredentials = false;
//smtp.Credentials = new System.Net.NetworkCredential(@"UserName", "Password");
//smtp.EnableSsl = true;
smtp.Send(mail);
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
}
Wednesday, December 15, 2010
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.-solution
solution
SqlConnection myConnection = new SqlConnection(ConnectionStringrk);
string strSQL;
strSQL = "runube_acctbal 'R55570001','IVG0001','" + sbledgr.ToString() + "','" + txtFdate.Text + "','" + txttdate.Text + " '";
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
cmd.CommandTimeout = 300; //5 min.
cmd.CommandType = CommandType.Text;
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
Monday, December 13, 2010
JD Edwards Fix Half posted IB Error batch (Sales Invoice)
1> Took backup for this batch for F0911 and F03B11.
2> Deleted all AE from F0911 for this batch using SQL.
3> Updated F0911 RPpost field with blank.
4> Updated F03B11 RPpost with P.
6> Ran Batch posting program(R09801) from P0011.
6> Batch posted correctly.
7> From F0911 batch Backup took Distinct GLAID and ran Repost program (R099102) to updated account balance.
Note: Use SQL on JD Edwards table with own risk.
Sunday, December 12, 2010
Silverlight 4 textbox Validation c#
http://www.codeproject.com/KB/silverlight/Silverlight4_Validation.aspx
Project estimation with Use Case Points using Enterprise Architect (EA)
As you may know, Use Case Points method involves different factors and needs calculation. For most software project managers it seems difficult and time consuming to use it manually.
In this article I will show you how to estimate a software project using Sprax Enterprise Architect (EA) which is a famous CASE tool. (I used EA 7.5 in this article)
Based on Rational Unified Process (RUP), In order to estimate software projects duration, you need to recognize the project features and requirements first. This leads you to Use Cases that are cores of a software project analysis model and you cannot estimate any software project without recognizing its Use Cases. Requirements, Features and Use Cases recognition are usually done in the first phase of RUP, Inception.
http://www.codeproject.com/KB/architecture/UCP_EA.aspx
Friday, December 10, 2010
ASP.NET MVC Diagnostics Using NuGet
Thursday, December 9, 2010
Wednesday, December 8, 2010
JD Edwards - SQL for Finding all the Releases from Blankets (OB and OHs)
JD Edwards - SQL for Finding all the Releases from Blankets (OB and OHs)
select pddoco OH,pddcto,pdoorn OB,pdlitm,pddsc1,pduorg,
DATEADD(dy, cast(pdtrdj as varchar(10)) % 1000, DATEADD(yy, cast(pdtrdj as varchar(10)) / 1000,-1)) pdtrdj
from proddta.f4311
where pdocto='OB' and pdlttr<>980
and pdoorn in
(16332,16334,17897,17924,17925,17699,18146,18155,18156,18164,18494,18218,18492,18527,18528,18531,18162)
order by pddoco
Silverlight Gird,Canvas ,Controls and Layout
Canvas
, Grid
, StackPanel
. http://www.codeproject.com/Articles/132079/Silverlight-Journey-Controls-and-Layout.aspx
Exploring Reactive Extensions (Rx) through Twitter and Bing Maps Mashups
DispatcherTimer
and WebControl
that perform some background work, firing events which are helpfully marshalled back onto the UI thread. However, Silverlight, and the other .NET UI frameworks, lack a way of orchestrating these asynchronous activities.In this article I will look at how the Reactive Extensions (Rx) library provides a common interface for asynchronous events and actions giving a consistent way to composite, orchestrate and marshal events between threads (and also have some fun creating a few cool mashups along the way!)
This article builds a couple of Rx powered Silverlight applications step by step, the final one being a Twitter / Bing Maps mashup that shows the location of snowfall in the UK based on users Tweets to the #uksnow hashtag.
http://www.codeproject.com/KB/silverlight/ExploringRx.aspx
Tuesday, December 7, 2010
Unhandled Error in Silverlight Application Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Tue, 7 Dec 2010 22:47:22 UTC
Message: Unhandled Error in Silverlight Application Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.CaptureGraph_Start(CaptureSource Source)
at System.Windows.Media.CaptureSource.Start()
at SilverlightApplication2.MainPage.StartWebCam()
at SilverlightApplication2.MainPage.button1_Click_1(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
URI: http://10.1.3.37/slvtest/
Message: Unhandled Error in Silverlight Application Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.CaptureGraph_Start(CaptureSource Source)
at System.Windows.Media.CaptureSource.Start()
at SilverlightApplication2.MainPage.StartWebCam()
at SilverlightApplication2.MainPage.button1_Click_1(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
URI: http://10.1.3.37/slvtest/
Unrecognized attribute 'targetFramework'.
Server Error in '/slvtest' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Unrecognized attribute 'targetFramework'.
Source Error:
|
Source File: C:\SilverlightApplication2\SilverlightApplication2.Web\web.config Line: 10
Error: Assembly System.Windows.Controls.DomainServices was not found. Siliverlight C#
use this : xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
http://msdn.microsoft.com/en-us/library/ee707363(VS.91).aspx
Thursday, December 2, 2010
Silverlight Working with Animations Programmatically
http://msdn.microsoft.com/en-us/library/cc189069$v=VS.95$.aspx
Silverlight Animation Overview
http://msdn.microsoft.com/en-us/library/cc189019$VS.95$.aspx#introducing_animations
Error in Silverlight Application Code: 2104 Category: InitializeError Message: Could not download the Silverlight application. Check web server settings
just started silverlight got thsi error.
How to fix this error?
I finally found the solution to this problem.
It seems like the MIME types for .xap and .xaml may need to be added to the individual website, not just the root. When I did this the problem went away.
It still leaves me with a problem on my hosted environment -- I guess I will have to get my web host support guys to add the MIME types to my website।
http://forums.silverlight.net/forums/p/111126/309207.aspx
JD Edwards How to fix IB Batch (invoice) error?
When you are getting error and not able to post sales update IB batches, you can do following steps:-
1. Check the peroid for that month is open or not if its not open , open that month and try posting.
2. check the work center for detail error messages if you are getting following error messages , see which particular invoice is giving error, get the
tax rate area for that invoice and type in fast path P4008, and correct the end date for tax rate area and then post the batch.
Subject : Error: Tax Area Invalid
CAUSE . . . . The tax area does not exist in the Tax Area Master
file (F4008). A tax area having an effective date prior
to the tax point date (service date) must exist in the
Tax Area file.
RESOLUTION. . Change the service date if applicable or change the tax area to
a valid tax area.
NOTE: The service date is not applicable in certain
circumstances. For example; Supplier Master, Customer
Master and Business Unit Revisions.
3.if you are getting error particular account not defined in AAI then, type DMAAI in fast path and fix that account or define that account in distribution aai.
4. if you are getting account inactive , then check account master for that particular account and make changes like allow all posting etc and then try to post.
Wednesday, December 1, 2010
Twitter New API C# post message from database continuous
Radio button in gridview From Code behind C#
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="Server">
<table style="width: 100%; height: 100%">
<tr>
<td >
<div>
<table style="vertical-align: sub; direction: ltr; text-indent: 10px; line-height: normal; letter-spacing: normal; text-align: left; background-color:White" border="1" cellpadding="0" cellspacing="0" width="80%" id="TABLE1" onclick="return TABLE1_onclick()" >
<tr>
<td>
</td>
<td align="center" >
<asp:Label ID="Label5" runat="server"> Week: </asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3"
DataTextField="Weeks" DataValueField="Weeks">
</asp:DropDownList>
<asp:Label ID="Label2" runat="server" Width="32px"></asp:Label>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" Visible="False" /></td>
<td >
</td>
</tr>
<tr>
<td >
</td>
<td align="center" >
<asp:Label ID="Label3" runat="server" Width="87px">Enter Name:</asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox2" Width="107px"></asp:RequiredFieldValidator></td>
<td >
</td>
</tr>
<tr>
<td >
</td>
<td >
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2" Width="70%" HorizontalAlign="Center">
<Columns>
<asp:BoundField DataField="week" HeaderText="week" SortExpression="week" Visible="false"/>
<asp:TemplateField HeaderText=" ">
<ItemTemplate>
<asp:RadioButton ID="MyRadioButton" GroupName="1111" Checked="True" runat="server" value='<%# Eval("FromTeam") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FromTeam" HeaderText="Road" ReadOnly="True" SortExpression="FromTeam" />
<asp:BoundField DataField="at" HeaderText="at" ReadOnly="True" SortExpression="at" Visible="false" />
<asp:TemplateField HeaderText=" ">
<ItemTemplate>
<asp:RadioButton ID="MyRadioButton1" GroupName="1111" runat="server" value='<%# Eval("toTeam") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Toteam" HeaderText="Home" ReadOnly="True" SortExpression="Toteam" />
<asp:BoundField DataField="date" HeaderText="Date" SortExpression="date" ItemStyle-BackColor="LightYellow" ItemStyle-Width="20" />
<asp:BoundField DataField="time" HeaderText="Time(EST)" SortExpression="time" ItemStyle-BackColor="LightYellow" ItemStyle-Width="70" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
</td>
<td >
</td>
</tr>
<tr>
<td style="height: 26px" >
</td>
<td style="height: 26px" align="center" >
<asp:Label ID="Label4" runat="server" Width="150px">Last Game's Points:</asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="136px" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required!" ControlToValidate="TextBox1"></asp:RequiredFieldValidator></td>
<td style="height: 26px" >
</td>
</tr>
<tr>
<td>
</td>
<td align="center">
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Value must be between 1 and 300" ControlToValidate="TextBox1"
Type="Integer" MinimumValue="1" MaximumValue="300" ></asp:RangeValidator>
<asp:Label ID="Label1" runat="server" Width="277px"></asp:Label></td>
<td>
</td>
</tr>
<tr>
<td >
</td>
<td align="center" >
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
</td>
<td >
</td>
</tr>
</table>
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NFLDBConnectionString %>"
SelectCommand="SELECT * FROM [vnflsch] WHERE ([week] = @week)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="week 1" Name="week"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [Weeks] FROM [wksaccs] WHERE ([prmsn] = @prmsn)">
<SelectParameters>
<asp:Parameter DefaultValue="Y" Name="prmsn" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NFLDBConnectionString %>"
SelectCommand="SELECT Week FROM [vnflweeks] order by cast(substring(Week,5,3) as int)"></asp:SqlDataSource>
</div>
</td>
</tr>
</table>
</asp:Content>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
public partial class userpicks : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
StringBuilder str = new StringBuilder();
StringBuilder str1 = new StringBuilder();
// Select the checkboxes from the GridView control
str1.Append("insert into uNflsel (uWeek,nicknm,Points,loginm,");
str.Append("'" + DropDownList1.SelectedItem.Text + "',");
str.Append("'" + TextBox2.Text + "',");
str.Append("'" + TextBox1.Text + "',");
str.Append("'" + Session["loginm"] + "',");
str.Append("'");
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
bool isChecked = ((RadioButton)row.FindControl("MyRadioButton")).Checked;
bool isChecked1 = ((RadioButton)row.FindControl("MyRadioButton1")).Checked;
if (isChecked)
{
if (GridView1.Rows.Count - 1 != GridView1.Rows[i].RowIndex)
{
str.Append(GridView1.Rows[i].Cells[2].Text);
str.Append("','");
str1.Append("G" + GridView1.Rows[i].RowIndex);
str1.Append(",");
}
else
{
str.Append(GridView1.Rows[i].Cells[2].Text);
str.Append("')");
str1.Append("G" + GridView1.Rows[i].RowIndex);
str1.Append(") values (");
}
}
else
if (GridView1.Rows.Count - 1 != GridView1.Rows[i].RowIndex)
{
str.Append(GridView1.Rows[i].Cells[5].Text);
str.Append("','");
str1.Append("G" + GridView1.Rows[i].RowIndex);
str1.Append(",");
}
else
{
str.Append(GridView1.Rows[i].Cells[5].Text);
str.Append("')");
str1.Append("G" + GridView1.Rows[i].RowIndex);
str1.Append(") values (");
}
}
string strSQLSB = str1.ToString() + str.ToString();
// Response.Write(strSQLSB);
// Response.End();
SqlDataAdapter myDataAdapter;
SqlConnection myConnection1 = new SqlConnection(ConnectionString);
string strSQL = "SELECT * FROM uNflsel where uweek='" + DropDownList1.SelectedItem.Text + "' and nicknm= '" + TextBox2.Text + "' ";
myDataAdapter = new SqlDataAdapter(strSQL, myConnection1);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "uNflsel");
// Label1.Text = Convert.ToString(myDataSet.Tables["uNflsel"].Rows.Count);
if ((myDataSet.Tables["uNflsel"].Rows.Count) != 0)
{
Label1.Text = "!!! You already did your picks !!!";
}
else
{
Label1.Text = "!!! Thanks You !!!";
//insert selection to table
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand(strSQLSB, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
}
}
private string ConnectionString
{
get
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
return connectionString;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
string style = @"<style> .text { mso-number-format:\@;border:.5pt solid black; } </style> ";
string attachment = "attachment; filename=Report.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}
}
Tuesday, November 30, 2010
Submitting a Windows Phone 7 Application to the Market - CodeProjec
Monday, November 29, 2010
Twitter new api C# :- continuous posting twitter
using
System.Data;using
System.Configuration;using
System.Collections;using
System.Web;using
System.Web.Security;using
System.Web.UI;using
System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using
System.Web.UI.HtmlControls;using
oAuthExample;using
System.Threading;public
partial class Default6 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
string url = ""; string xml = ""; oAuthTwitter oAuth = new oAuthTwitter(); if (Request["oauth_token"] == null){
oAuth.CallBackUrl =
"http://localhost/twitterpost/default6.aspx";Response.Redirect(oAuth.AuthorizationLinkGet());
}
else{
Response.Write(oAuth.TokenSecret.Length);
if (oAuth.TokenSecret.Length <= 0){
oAuth.AccessTokenGet(Request[
"oauth_token"], Request["oauth_verifier"]);}
if (oAuth.TokenSecret.Length > 0){
url =
"http://twitter.com/account/verify_credentials.xml";xml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.GET, url, String.Empty);apiResponse.InnerHtml = Server.HtmlEncode(xml);
url =
"http://twitter.com/statuses/update.xml";xml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on Football Products http://visli.com/mainsearch/Football/All/1.aspx"));apiResponse.InnerHtml = Server.HtmlEncode(xml);
Response.Write(
"time 1 =>" +DateTime.Now.ToLongTimeString());System.Threading.
Thread.Sleep(120000);Response.Write(
"<br>time 2 =>" + DateTime.Now.ToLongTimeString()); // url = "http://twitter.com/statuses/update.xml"; Trousersxml = oAuth.oAuthWebRequest(
oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode("#Cybermonday deals on basketball... http://visli.com/mainsearch/basketball/All/1.aspx"));apiResponse.InnerHtml = Server.HtmlEncode(xml);
}
}
}
}
JD Edwards: How to Remove a RB batch from System
my batch# was 70242
--delete from proddta.f03b13 where ryicu=70242
--delete from proddta.f03b11 where rpicu=70242
--delete from proddta.f0911 where glicu=70242
Sunday, November 28, 2010
10 Essential Tools for Building ASP.NET Websites
Creating a ASP.NET MVC HTML Helper for Silverlight
Friday, November 26, 2010
Routing in ASP.NET
http://haacked.com/archive/2010/11/21/named-routes-to-the-rescue.aspx
Wednesday, November 24, 2010
Maximum request length exceeded. asp.net
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.] System.Web.HttpRequest.GetEntireRawContent() +11141623 System.Web.HttpRequest.FillInFormCollection() +129 System.Web.HttpRequest.get_Form() +119 System.Web.HttpRequest.get_HasForm() +11072695 System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124 System.Web.UI.Page.DeterminePostBackMode() +83 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[HttpException (0x80004005): Maximum request length exceeded.] System.Web.HttpRequest.GetEntireRawContent() +11141623 System.Web.HttpRequest.FillInFormCollection() +129 System.Web.HttpRequest.get_Form() +119 System.Web.HttpRequest.get_HasForm() +11072695 System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124 System.Web.UI.Page.DeterminePostBackMode() +83 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270
Tuesday, November 23, 2010
Accessing Server-Side Data from Client Script: Using WCF Services with jQuery and the ASP.NET Ajax Library
Today's websites commonly exchange information between the browser and the web server using Ajax techniques - the browser executes JavaScript code typically in response to the page loading or some user action. This JavaScript makes an asynchronous HTTP request to the server. which then processes the request and, perhaps, returns data that the browser can then seamlessly integrate into the web page. Two earlier articles - Accessing JSON Data From an ASP.NET Page Using jQuery and Using Ajax Web Services, Script References, and jQuery, looked at using both jQuery and the ASP.NET Ajax Library on the browser to initiate an Ajax request and both ASP.NET pages and Ajax Web Services..more...
http://www.4guysfromrolla.com/articles/111710-1.aspx
C# Twitter auto post error
Message: Sys.WebForms.PageRequestManagerServerErrorException: The remote server returned an error: (401) Unauthorized.
Line: 868
Char: 13
Code: 0
URI: http://localhost/twitterpost/ScriptResource.axd?d=xx5DcacSwVVveclpzpHq2-LXWURIUfynVz7pWaz73heKi6nCrTVxg5HtpwrjU7BOloH-k8h0BVS-wYBpVV-156MzkfrUqR9pOcJxUOB35X5rSsvuR97HR16wGYIDHMP8YE8SkccccL8iujeA5OmyhtO2XUbN6-VETwaajPuOmuysRn17A9FbpPaAyuMN0&t=2610f696
Monday, November 22, 2010
JD Edwards : Sales count by year/month and search type
datepart(yy,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
datepart(mm,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
abat1,count(*) from sales_f4211_f42119 --(union f4211/f42119)
left outer join proddta.f0101 on sdshan=aban8
where sddcto='SO' and sdnxtr=999 and sdlttr<>980
group by abat1,
datepart(yy,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) ),
datepart(mm,DATEADD(dy, cast(SDTRDJ as varchar(10)) % 1000, DATEADD(yy, cast(SDTRDJ as varchar(10)) / 1000,-1)) )
Currency Converter For Windows Phone 7
Phone 7 using Microsoft Visual Studio Express 2010 for the Windows Phone.
http://www.codeproject.com/KB/windows-phone-7/Phone7Programming.aspx
Sunday, November 21, 2010
Formatting Dates, Times in ASP.NET 4.0
Format Description | Code Snippet | Output |
---|---|---|
Short date pattern (d) | DateTime.Now.ToString("d") | 11/8/2010 |
Long date pattern (D) | DateTime.Now.ToString("D") | Monday, November 08, 2010 |
Full date/time pattern - short time (f) | DateTime.Now.ToString("f") | Monday, November 08, 2010 3:39 PM |
Full date/time pattern - long time (F) | DateTime.Now.ToString("F") | Monday, November 08, 2010 3:39:46 PM |
General date/time pattern - short time (g) | DateTime.Now.ToString("g") | 11/8/2010 3:39 PM |
General date/time pattern - long time (G) | DateTime.Now.ToString("G") | 11/8/2010 3:39:46 PM |
Month/day pattern (M) | DateTime.Now.ToString("M") | November 08 |
Round-trip date/time pattern (O) | DateTime.Now.ToString("O") | 2010-11-08T15:39:46.4804000-08:00 |
RFC 1123 pattern (R) | DateTime.Now.ToString("R") | Mon, 08 Nov 2010 15:39:46 GMT |
Sortable date/time pattern (s) | DateTime.Now.ToString("s") | 2010-11-08T15:39:46 |
Short time pattern (t) | DateTime.Now.ToString("t") | 3:39 PM |
Long time pattern (T) | DateTime.Now.ToString("T") | 3:39:46 PM |
Universal sortable date/time pattern (u) | DateTime.Now.ToString("u") | 2010-11-08 15:39:46Z |
Universal full date/time pattern (U) | DateTime.Now.ToString("U") | Monday, November 08, 2010 11:39:46 PM |
Year/month pattern (Y) | DateTime.Now.ToString("Y") | November, 2010 |
Saturday, November 20, 2010
Credit Card Validator Attribute for ASP.NET MVC 3
Friday, November 19, 2010
Thursday, November 18, 2010
JD Edwards EnterpriseOne Year End CENTCHG data dictionary 2010
Dear Valued JD Edwards EnterpriseOne Customer,
According to our records your company is currently using Oracle JD Edwards EnterpriseOne. We want to make you aware of an important update that users should make in the EnterpriseOne CENTCHG data dictionary.
JD Edwards EnterpriseOne stores calendar dates in Julian date format. The system allows two-digit dates to be entered to facilitate data entry. The system uses data dictionary item CENTCHG (CenturyChangeYear) to determine the century to use for populating data tables. The system also uses this data dictionary item when automatically populating the default effective through and expiration dates in some data tables.
In releases Xe and ERP8.0, the default value for CENTCHG was set to 10. Thus dates populated using the CENTCHG default value are created as '12/31/2010'. In release 8.9, the default value was set to 15, creating a date of '12/31/2015'. In releases 8.10 through 9.0, the default value was set to 40, creating a date of '12/31/2040'. Oracle recommends that this value be increased for users in the Xe, ERP8.0, and 8.9 releases as well as users who have upgraded from these releases to 8.10 or higher so that the software will supply new effective through dates further into the future.
The document, linked below, outlines the function of CENTCHG in the software and recommends a change to the CENTCHG data dictionary default as soon as possible. This document also introduces the Date Utility, a tool designed to assist users with identifying and resolving business data with potential date issues. The Date Utility is designed for use with the currently supported tools releases.
Instructions (Knowledge Article 882478.1)
If you have any questions or concerns and we can be of assistance, please contact your Global Customer Support Center
Lyle Ekdahl
Group Vice President. General Manager
Oracle JD Edwards
Wednesday, November 17, 2010
Get a facebook email address
MAC and Xcode in Windows iPod, iPhone and iPad
Tuesday, November 16, 2010
Validation (XHTML 1.0 Transitional): Element 'video' is not supported. html5
Google map api total distance and duration calculation C#
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load("http://maps.googleapis.com/maps/api/directions/xml?origin=92610&destination=92630&sensor=false");
XmlNodeList xnList = xDoc.SelectNodes("DirectionsResponse/route/leg/distance");
foreach (XmlNode xn in xnList)
{
Response.Write("distance-> "+xn["text"].InnerText);
}
XmlNodeList xnList1 = xDoc.SelectNodes("DirectionsResponse/route/leg/duration");
foreach (XmlNode xn in xnList1)
{
Response.Write("<br>duration-> " + xn["text"].InnerText);
}
}
Monday, November 15, 2010
Comma Delimited value in sql-server where condition
DECLARE
@psCSString VARCHAR(1000)set
@psCSString='123,456,789,0123,dsdsd'create
table #otTemp (fld varchar(20)) WHILE LEN(@psCSString) > 0 BEGIN SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1), LEN(@psCSString))) SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0), LEN(@psCSString)) + 1, LEN(@psCSString))INSERT
INTO #otTemp VALUES (@sTemp)--drop table #otTemp
--select @sTemp
END select * from dshsjh in( select * from #otTemp) drop table #otTempParsing string variable in Where clause with commas
string variable in Where clause with commas
DECLARE @sTemp VARCHAR(1000)
DECLARE @psCSString VARCHAR(1000)
set @psCSString='dsdss,dsdd,sddsds,43443,dsdsd'
WHILE LEN(@psCSString) > 0
BEGIN
SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1),
LEN(@psCSString)))
SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0),
LEN(@psCSString)) + 1, LEN(@psCSString))
-- INSERT INTO @otTemp VALUES (@sTemp)
select @sTemp
END
Split parameter string from comma seperator in SQL IN clause
Thursday, November 11, 2010
Wednesday, November 10, 2010
Call Javascript from code behind c# sample
Google map API distance C# javascript calling from code behind
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API Example: Extraction of Geocoding Data</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA7j_Q-rshuWkc8HyFI4V2HxQYPm-xtd00hTQOC0OXpAMO40FHAxT29dNBGfxqMPq5zwdeiDSHEPL89A" type="text/javascript"></script>
<!-- According to the Google Maps API Terms of Service you are required display a Google map when using the Google Maps API. see: http://code.google.com/apis/maps/terms.html -->
<script type="text/javascript">
var geocoder, location1, location2;
function showLocation() {
geocoder = new GClientGeocoder();
geocoder.getLocations(document.forms[0].address1.value, function (response) {
if (!response || response.Status.code != 200)
{
alert("Sorry, we were unable to geocode the first address");
}
else
{
location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
geocoder.getLocations(document.forms[0].address2.value, function (response) {
if (!response || response.Status.code != 200)
{
alert("Sorry, we were unable to geocode the second address");
}
else
{
location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address};
calculateDistance();
}
});
}
});
}
function calculateDistance()
{
try
{
var glatlng1 = new GLatLng(location1.lat, location1.lon);
var glatlng2 = new GLatLng(location2.lat, location2.lon);
var miledistance = glatlng1.distanceFrom(glatlng2, 3959).toFixed(1);
var kmdistance = (miledistance * 1.609344).toFixed(1);
//document.getElementById('results').innerHTML = '<strong>Address 1: </strong>' + location1.address + '<br /><strong>Address 2: </strong>' + location2.address + '<br /><strong>Distance: </strong>' + miledistance + ' miles (or ' + kmdistance + ' kilometers)';
document.getElementById("Label1").innerHTML = '<strong>Address 1: </strong>' + location1.address + '<br /><strong>Address 2: </strong>' + location2.address + '<br /><strong>Distance: </strong>' + miledistance + ' miles (or ' + kmdistance + ' kilometers)';
}
catch (error)
{
alert(error);
}
}
</script>
</head>
<body>
<form id="wedkj" runat="server">
<p>
<input type="text" name="address1" value="92610" class="address_input"
size="40" />
<input type="text" name="address2" value="92679" class="address_input"
size="40" />
<input type="submit" name="find" value="Search" />
</p>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default10 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Label1.Text = inpHide.Value;
// Response.Write(Label1.innerHtml);
//Response.Write("dsdsdsd");
// Response.Write(Label2.Text);
}
protected void Button1_Click(object sender, EventArgs e)
{
//Response.Write("1111dssddsddsdssd");
Button1.Attributes.Add("onclick", "showLocation(); return false;");
}
protected void Button2_Click(object sender, EventArgs e)
{
//Response.Write(Label1.Text);
}
}