Sunday, February 14, 2010

.net Framework 3.5 Feature

WPF- Windows Presentation Foundation

WCF- Windows Communication Foundation

WF- WorkFlow Foundation

Linq

Friday, February 12, 2010

Cursor Example in SQL Server

declare cursor_content cursor for select * from content

open cursor_content

fetch next from cursor_content

close cursor_content

deallocate cursor_content

Thursday, February 11, 2010

ImageStoring and Retrieval In Windows Application Using C#

// Storing of the Image //

MemoryStream stream = new MemoryStream();
pictureBox1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic = stream.ToArray();
cmd.Parameters.AddWithValue("@img", pic);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();

// Retrieval of the Image //

SqlDataAdapter ada = new SqlDataAdapter(cmd);
ds = new DataSet();
ada.Fill(ds);
byte[] bytes = (byte[])ds.Tables[0].Rows[0][1];
MemoryStream mem = new MemoryStream(bytes);
Bitmap map = new Bitmap(mem);
pictureBox1.Image = map;


// Display Using Timer Values //


private void timer1_Tick(object sender, EventArgs e)
{
Bitmap map ;
if (cnt < ds.Tables[0].Rows.Count)
{
byte[] bytes = (byte[])ds.Tables[0].Rows[cnt][1];
MemoryStream mem = new MemoryStream(bytes);
map = new Bitmap(mem);
pictureBox1.Image = map;
cnt += 1;
}
else
{
cnt = 0;
}
}

Webapplication Word Document posting

Int32 File1Length = FileUpload1.PostedFile.ContentLength;
System.IO.Stream File1Stream;
File1Stream = FileUpload1.PostedFile.InputStream;
byte[] File1Content = new byte[File1Length];
File1Stream.Read(File1Content, 0, File1Length);

Saturday, January 30, 2010

How to Delete a row from datatable

dt.Rows[i].Delete();

Or

foreach (DataRow dr in dt.Rows)
{
if ((dr["Doc_Name"].ToString().Trim() == "RAJA".ToString()))
{
dr.Delete();

}
}
dt.AcceptChanges();

Hot Create Random Number Using C#

Random randNum = new Random();

int i = randNum.Next(0, 10);

Friday, January 8, 2010

Bug Fixing in .net

1) Microsoft company website not open&surfing


1. First Try Windows malicious Removal program

if it's not solve the problem try another option

2. Stop dns client service in local service

2) Error while trying to run project: cannot start debugging. The assembly to be debugged was built with a platform incopatible with the current system


But i figured out the probelm and it seems to be a bug in Visual Studio 2005.

There is something called as the configuration Manager where u can specify the the type of the target machine code u want .. say X86 or X64. There is also this ANY CPU option( default).

But looks like there is a goof up in the menu associated and if u select the target machine to be X64 u get an exe which can run on any cpu and if the setting is is ANY CPU u can run it only on X64 !!!!!!