Friday, June 26, 2009

Quotation in where condition sql-server

quotation in where condition sql-server

SELECT * FROM zzzzz WHERE zzzz = 'ZZzZ'cccc' change it
to SELECT * FROM zzzzz WHERE zzzz = 'ZZzZ''cccc'

Windows 7 Upgrade

Windows 7 is the easiest, fastest, and most engaging version of Windows yet. Better ways to find and manage files, like Jump Lists and improved taskbar previews, help you speed through everyday tasks. Faster and more reliable performance means your PC just works the way you want it to. And great features like Windows Media Center and Windows Touch make new things possible. Get to know Windows 7, and see how it can simplify just about everything you do with your PC.

Windows 7 will be available on October 22. It includes tons of little refinements—
and a few big ones—many suggested by you. The result? Everyday computing is
faster, simpler, easier.
Order Now Your Upgrade Version Save more then $100.

Windows7 Home Premium Upgrade

Windows7 Professional Upgrade

Wednesday, June 24, 2009

Twitter asp.net 2.0, C# sample

I created following application to post in Twitter by using twitter apis..in asp.net 2.0, C#
 
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>

<!

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>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<div>

<table style="width: 50%" align="center">

<tr>

<td>

</td>

<td>

</td>

<td>

</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="Label2" runat="server" Text="User Id:"></asp:Label></td>

<td>

<asp:TextBox ID="txtusrid" runat="server" Width="144px"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="Label3" runat="server" Text="Password:"></asp:Label></td>

<td>

<asp:TextBox ID="txtpass" runat="server" TextMode="Password"></asp:TextBox></td>

<td>

</td>

</tr>

<tr>

<td align="right" style="height: 40px">

<asp:Label ID="Label1" runat="server" Text="Messages:"></asp:Label></td>

<td style="height: 40px">

<asp:TextBox ID="txtmessage" runat="server" TextMode="MultiLine" Width="259px" Height="99px"></asp:TextBox>

</td>

<td style="height: 40px">

</td>

</tr>

<tr>

<td style="height: 21px">

</td>

<td style="height: 21px">

<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />

<asp:Label ID="Label4" runat="server" Width="126px"></asp:Label></td>

<td style="height: 21px">

</td>

</tr>

</table>

</div>

</form>

</

body>
</
html>
 
Code behind

using

System;

using

System.Net;

using

System.Web;

using

System.IO;

public

partial class Default5 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

public void SubmitUserMsg(string username, string passwd, string txttweet)

{

string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + passwd));

byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + txttweet);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml");

request.Method =

"POST";

request.ServicePoint.Expect100Continue = false;

request.Headers.Add(

"Authorization", "Basic " + user);

request.ContentType =

"application/x-www-form-urlencoded";

request.ContentLength = bytes.Length;

Stream reqStream = request.GetRequestStream();

reqStream.Write(bytes, 0, bytes.Length);

reqStream.Close();

Label4.Text =

"Message Posted";

}

protected void Button1_Click(object sender, EventArgs e)

{

SubmitUserMsg(txtusrid.Text, txtpass.Text, txtmessage.Text);

}

}

Tuesday, June 23, 2009

Error: Sys.WebForms.PageRequestManagerParserErrorException:

Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

change this <asp:ScriptManager ID="ScriptManager1" runat="server" />
to this <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false" />
this may fix your problem

HTML Editor ajax toolkit 3.5 vs 2008 Sample

Working sample for HTML Editor ajax toolkit 3.5 VS 2008 Sample ..Rich textbox sample...
 
 
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false" ValidateRequest="false" Trace="false"%>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<%

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="HTMLEditor" %>

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<

div>

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<script type="text/javascript">

</script>

<asp:UpdatePanel ID="updatePanel1" runat="server">

<ContentTemplate>

<HTMLEditor:Editor runat="server" Id="editor" Height="300px" AutoFocus="true" Width="100%" />

<br />

<asp:Button runat="server" Text="Submit content" ID="submit"

onclick="submit_Click" />

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</

body>

</

html>

Monday, June 22, 2009

Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. error

getting error
Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 
 
change:
<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
 
to: <asp:ScriptManager ID="ScriptManager1" runat="server" />

 

Encrypting the Web.Config File -- Visual Studio Magazine

Encrypting the Web.Config File -- Visual Studio Magazine

Sunday, June 21, 2009

What is Google Wave?

Google Wave is a new tool for communication and collaboration on the web, coming later this year.
 
 
api: code.google.com/apis/wave/
 
 

Friday, June 19, 2009

How to generate serial Number in DataList? asp.net

How to generate serial Number in DataList?


<asp:TemplateField HeaderText="SLr.No">
           <ItemTemplate>
          <asp:Label ID="lbSnNo" runat="Server" Text='<%# Container.ItemIndex + 1 %>' />
           </ItemTemplate>
</asp:TemplateField>

 

How to Define style in code behind C#?

Sample:
dynTable =
"<table align=\"center\" width=\"85%\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\" style=\"width:100%;border-collapse:collapse; border-style:solid; border-width:1\">";

Active desktop recovery problem

Getting following error when try to do active desktop revovery.
 
I fixed my pc I went to desktop ->right click on properties ->desktop ->select windows XP -OK
and its fixed.
 
 
 

Thursday, June 18, 2009

Newsletter sample template using access database , C# and smtp

Newsletter format using access database , C# and smtp

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="nl1.aspx.cs" Inherits="nl1" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; " id="maintabl" runat="server">
<tr>
<td colspan="1" align="center" >



&nbsp; &nbsp; &nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send" /></td>
</tr>
<tr>
<td valign="top">
<asp:Label ID="Label1" runat="server" Text="Label" BackColor="Transparent" Width="100%"></asp:Label><br />

<br />
<br />
</td>
</tr>
<tr>
<td colspan="1" style="height: 20px" align="center" >
<asp:Label ID="labmsg" runat="server"></asp:Label></td>
</tr>
</table>
&nbsp;
&nbsp;&nbsp;
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>

Code Behind......

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.Data.OleDb;
using System.Web.Mail;

public partial class nl1 : System.Web.UI.Page
{
string dynTable = "";
protected void Page_Load(object sender, EventArgs e)
{
string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=c:\\xxxx\\database\\MailDB.mdb";
OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);
OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand();
string ProdTy = "M2";
string Strsql = "SELECT top 5 * from DetailURLMisc ";
myOleDbCommand.CommandText = Strsql;
myOleDbConnection.Open();
OleDbDataReader myOleDbDataReader = myOleDbCommand.ExecuteReader();
myOleDbDataReader.Read();

dynTable = "<table align=\"center\" width=\"95%\" cellspacing=\"0\" cellpadding=\"3\" border=\"1\">";
dynTable += "<tr><td height=\"50px\" style=\"background-color:Blue\" colspan=\"3\">"
+"<a href=\"default.aspx\" style=\"text-decoration: none\"><font class=\"X-small\""
+"color=\"gold\" size=\"6\"><font color=\"red\" face=\"Monotype Corsiva\">Header</font></font></a>"
+ "</td></tr>";
dynTable += "<tr><td height=\"25px\" style=\"background-color:Silver\" colspan=\"3\">Header2</td></tr>";
dynTable += "<tr>";
dynTable += "<td width=\"20%\">&nbsp;1</td>";
dynTable += "<td width=\"50%\" valign=\"top\">President Barack Obama's plan to transform the Federal Reserve into a super-regulator ran into skepticism Thursday from lawmakers who worry that the central bank is not the best suited to keep an eye on firms deemed so big and influential that their demise could hurt the economy.</td>";
dynTable += "<td width=\"30%\">";
while (myOleDbDataReader.Read())
{

//dynTable += "<td>"+(myOleDbDataReader["TextUrl"].ToString())+"</td>";

dynTable += "<a href=" + myOleDbDataReader["NameUrl"].ToString() + "><img border=0 src=" + (myOleDbDataReader["ImageUrl"].ToString()) + "xxx></img></a>"
+ "<a href=" + myOleDbDataReader["NameUrl"].ToString() + ">" + (myOleDbDataReader["TextUrl"].ToString()) + "</a><br/>";

}
dynTable += "</td></tr>";
dynTable += "<tr><td height=\"25px\" style=\"background-color:Silver\" colspan=\"3\">&nbsp;Footer</td></tr>";
dynTable += "</table>";
Label1.Text = dynTable.ToString();

}

void sndmail()
{
MailMessage oMessage = new MailMessage();
oMessage.To = "xxxxxx@gmail.com";
oMessage.From = "vvvvv@xxxxxx.net";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
oMessage.Subject = "Great Find";
oMessage.Body = dynTable;
oMessage.BodyFormat = MailFormat.Html;
//oMessage.Attachments = txtBody.Text;
//Response.Write("http://www.visli.com/" + System.IO.Path.GetFileName(Request.Url.ToString()));
oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.xxxxx.net";
oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "kkkkk@xxxxxx.net";
//oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "xxxxx";
oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
System.Web.Mail.SmtpMail.SmtpServer = "mail.xxxxxx.net";//
try
{
oMessage = oMessage;
System.Web.Mail.SmtpMail.Send(oMessage);
labmsg.Text = "Message Send";
}
catch (Exception Ex)
{
labmsg.Text = ("Unable to send mail! " + Ex.Message);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//Label2.Text = maintabl;
sndmail();
}
}