using System.Collections;
public partial class sample : System.Web.UI.Page
{
Col < string > str = new Col < string > ();
Col < int > inser = new Col< int >();
protected void Page_Load(object sender, EventArgs e)
{
str.Val="hai";
str.Val = "hello";
inser.Val=1;
inser.Val = 2;
inser.Val = 3;
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = str.Val.ToString();
Button1.Text = inser.Val.ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
ArrayList al = new ArrayList();
for (int i = 0; i < 100; i++)
{
al.Add(i);
}
DropDownList1.DataSource = al;
DropDownList1.DataBind();
}
}
public class Col< T >
{
T t;
public T Val
{
get
{
return t;
}
set
{
t = value;
}
}
}
Sunday, February 14, 2010
.net Framework 2.0 Feature
Partial Class - Two more user can work with same class name
Master Page - Master Design Applied to Child Page
Ajax Control - Used to Design good webpage
Generics - Handle two different Datatype in Array List
Master Page - Master Design Applied to Child Page
Ajax Control - Used to Design good webpage
Generics - Handle two different Datatype in Array List
.net Framework 3.5 Feature
WPF- Windows Presentation Foundation
WCF- Windows Communication Foundation
WF- WorkFlow Foundation
Linq
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
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;
}
}
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);
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();
Or
foreach (DataRow dr in dt.Rows)
{
if ((dr["Doc_Name"].ToString().Trim() == "RAJA".ToString()))
{
dr.Delete();
}
}
dt.AcceptChanges();
Subscribe to:
Posts (Atom)