Saturday, December 24, 2011

Short Codes of Samsung Mobile

//////codes of samsung mobiles


*2767*JAVA# Java Reset and (Deletes all Java Midlets)
*2767*MEDIA# Reset Media (Deletes All Sounds and Pics)

(no 2 code for delete hiden fav vedios in phone memory which can not be deleted simply )
*2767*WAP# Wap Reset
*2767*CUST# Reset Custom EEPR0M
*2767*FULL# Reset Full EEPR0M (Caution)



//////some others code for samsung also by mithilesh

*#06# IMEI code
*#9998*4357# Help Menu
*#9998*5282# Java menu (GRPS/CSD settings for JAVA server)
*#9999#0# Monitor Mode

*#9998*746# or *#9998*0746# or *#0746# Sim Infos
*#9998*523# or *#9998*0523# or *#0523# Display Contrast
*#8999*638# show network information
*#9998*5646# change operator logo at startup
*#9998*76# production number

*#9998*842# or *#9998*0842# or *#0842# Vibration On (until you push OK)

*#3243948# Digital Audio Interference Off


*#9998*968# view melody for alarm
*#9998*585# Non-Volatile Memory (NVM)

*#8888# or *#9998*8888# Hardware Version
*#9999# or *#9998*9999# Software Version
*#9998*289# or *#9998*0289# or *#0289# Buzzer On (until you push OK)
*#9998*288# or *#9998*0288# or *#0288# Battery & Field Infos


*#9998*377# or *#9998*0377# Error log
*#9998*778# or *#9998*0778# or *#0778# Sim Service table
*#9998*782# show date and alarm clock

*#32436837# Digital Audio Interference On


///////////miscellneous codes for samsung.......


*#06# -> Show IMEI
*#9999# -> Show Software Version
*#0001# -> Show Serial Parameters

*2767*3855# -> Full EEPROM Reset ( THIS CODE REMOVES SP-LOCK!!!! but also change IMEI to 447967-89-400044-0, you must use CHGIMEI to restore it)

*2767*2878# -> Custom EEEPROM Reset
*#8999*228# -> Battery status (capacity, voltage, temperature)
*#8999*246# -> Program status

*#8999*862# -> Vocoder Reg
*#8999*872# -> Diag
*#8999*947# -> Reset On Fatal Error

*#8999*786# -> Run, Last UP, Last DOWN
*#8999*837# -> Software Version
*#8999*289# -> Change Alarm Buzzer Frequency
*#8999*324# -> Debug screens
*#8999*364# -> Watchdog
*#8999*377# -> EEPROM Error Stack
*#8999*427# -> Trace Watchdog
*#8999*523# -> Change LCD contrast

*#8999*746# -> SIM File Size
*#8999*778# -> SIM Service Table
*#8999*785# -> RTK (Run Time Kernel) errors

*#8999*544# -> Jig detect
*#8999*636# -> Memory status

*#8999*862# -> Vocoder Reg
*#8999*872# -> Diag
*#8999*947# -> Reset On Fatal Error
*#8999*999# -> Last/Chk
*#8999*9266# -> Yann debug screen (=Debug Screens?)
*#8999*9999# -> Software version *#8999*842# -> Test Vibrator

*#8999*999# -> Last/Chk
*#8999*9266# -> Yann debug screen (=Debug Screens?)
*#8999*9999# -> Software version



for unlocking........

47*869#08#9

- unlock code / change roaming code / ID

/////////////unverifed code(use at own risk)

*7465625*27*
*7465625*2827# – Auto CP lock activated

*7465625*28746# – Auto SIM lock activated
*7465625*638*
*7465625*746
*335#
*663867# – mm file dumped
*7465625# –
*7465625*228# – Activa lock personalized

*7465625*28638# – Auto Network lock activated
*7465625*746*
*7465625*2877# – Auto SP lock activated

*7465625*28782# – Auto subset lock activated

*7465625*77*
*7465625*782*






Monday, December 19, 2011

For maintain session state in sql server database

go to vs command prompt and type following ,if u r using Express Edition.

aspnet_regsql
E -S .\SQLEXPRESS ssadd sstype p

then a new data base will be created Name "AspState" which is used for
maintain session and your application.




//////for stateserver(out proc)


first goto control panel then admin services then start the
astnet state server ,,,,,,
after that type the following in web.config file.






sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424"



because your stater server is running on local host so the ip og state server is 127.0.0.1 an dthe port on which state servrer is running is 42424.....

Friday, December 16, 2011

Function of Date Time Conversion in sql server

create FUNCTION dbo.DateTimeFormat
(
@dt DATETIME,
@format VARCHAR(16)
)
RETURNS VARCHAR(64)
AS
BEGIN
DECLARE @dtVC VARCHAR(64)
SELECT @dtVC = CASE @format
WHEN 'ddmmmmyyyy' THEN
CAST(DAY(@dt) AS VARCHAR(2))
+ SPACE(1) + DATENAME(m, @dt)
+ SPACE(1) + CAST(YEAR(@dt) AS CHAR(4))


WHEN 'LONGDATE' THEN
DATENAME(dw, @dt)
+ ',' + SPACE(1) + DATENAME(m, @dt)
+ SPACE(1) + CAST(DAY(@dt) AS VARCHAR(2))
+ ',' + SPACE(1) + CAST(YEAR(@dt) AS CHAR(4))
WHEN 'LONGDATEANDTIME' THEN
DATENAME(dw, @dt)
+ ',' + SPACE(1) + DATENAME(m, @dt)
+ SPACE(1) + CAST(DAY(@dt) AS VARCHAR(2))
+ ',' + SPACE(1) + CAST(YEAR(@dt) AS CHAR(4))
+ SPACE(1) + RIGHT(CONVERT(CHAR(20),
@dt - CONVERT(DATETIME, CONVERT(CHAR(8),
@dt, 112)), 22), 11)
WHEN 'SHORTDATE' THEN
LEFT(CONVERT(CHAR(19), @dt, 0), 11)
WHEN 'SHORTDATEANDTIME' THEN
REPLACE(REPLACE(CONVERT(CHAR(19), @dt, 0),
'AM', ' AM'), 'PM', ' PM')
WHEN 'UNIXTIMESTAMP' THEN
CAST(DATEDIFF(SECOND, '19700101', @dt)
AS VARCHAR(64))
WHEN 'YYYYMMDD' THEN
CONVERT(CHAR(8), @dt, 112)
WHEN 'YYYY-MM-DD' THEN
CONVERT(CHAR(10), @dt, 23)
WHEN 'YYMMDD' THEN
CONVERT(VARCHAR(8), @dt, 12)
WHEN 'YY-MM-DD' THEN
STUFF(STUFF(CONVERT(VARCHAR(8), @dt, 12),
5, 0, '-'), 3, 0, '-')
WHEN 'MMDDYY' THEN
REPLACE(CONVERT(CHAR(8), @dt, 10), '-', SPACE(0))
WHEN 'MM-DD-YY' THEN
CONVERT(CHAR(8), @dt, 10)
WHEN 'MM/DD/YY' THEN
CONVERT(CHAR(8), @dt, 1)
WHEN 'MM/DD/YYYY' THEN
CONVERT(CHAR(10), @dt, 101)
WHEN 'DDMMYY' THEN
REPLACE(CONVERT(CHAR(8), @dt, 3), '/', SPACE(0))
WHEN 'DD-MM-YY' THEN
REPLACE(CONVERT(CHAR(8), @dt, 3), '/', '-')
WHEN 'DD/MM/YY' THEN
CONVERT(CHAR(8), @dt, 3)
WHEN 'DD/MM/YYYY' THEN
CONVERT(CHAR(10), @dt, 103)
WHEN 'HH:MM:SS 24' THEN
CONVERT(CHAR(8), @dt, 8)
WHEN 'HH:MM 24' THEN
LEFT(CONVERT(VARCHAR(8), @dt, 8), 5)
WHEN 'HH:MM:SS 12' THEN
LTRIM(RIGHT(CONVERT(VARCHAR(20), @dt, 22), 11))
WHEN 'HH:MM 12' THEN
LTRIM(SUBSTRING(CONVERT(
VARCHAR(20), @dt, 22), 10, 5)
+ RIGHT(CONVERT(VARCHAR(20), @dt, 22), 3))

ELSE
'Invalid format specified'
END
RETURN @dtVC
END


________________________Excute

DECLARE @now DATETIME
SET @now = GETDATE()
PRINT dbo.DateTimeFormat(@now, 'ddmmmmyyyy')
PRINT dbo.DateTimeFormat(@now, 'LONGDATEANDTIME')

Tuesday, September 20, 2011

Varius connectionstrings in .NET Framework Data Provider for SQL Server

Standard Security

Data Source =myServerAddress; Initial Catalog =myDataBase; User Id =myUsername; Password =myPassword;

Use serverName\instanceName as Data Source to connect to a specific SQL Server instance.

Are you using SQL Server 2005 Express? Don't miss the server name syntax Servername\SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2005 Express installation resides.

Standard Security alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

Server =myServerAddress; Database =myDataBase; User ID =myUsername; Password =myPassword; Trusted_Connection =False;

Trusted Connection

Data Source =myServerAddress; Initial Catalog =myDataBase; Integrated Security =SSPI;

Trusted Connection alternative syntax

This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.

Server =myServerAddress; Database =myDataBase; Trusted_Connection =True;

Connecting to an SQL Server instance

The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.

Server =myServerName\theInstanceName; Database =myDataBase; Trusted_Connection =True;

Trusted Connection from a CE device

Often a Windows CE device is not authenticated and logged in to a domain. To use SSPI or trusted connection / authentication from a CE device, use this connection string.

Data Source =myServerAddress; Initial Catalog =myDataBase; Integrated Security =SSPI; User ID =myDomain\myUsername; Password =myPassword;

Connect via an IP address

Data Source =190.190.200.100,1433; Network Library =DBMSSOCN; Initial Catalog =myDataBase; User ID =myUsername; Password =myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

Enabling MARS (multiple active result sets)

Server =myServerAddress; Database =myDataBase; Trusted_Connection =True; MultipleActiveResultSets =true;

Use ADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 nor ADO.NET 1.1.

Attach a database file on connect to a local SQL Server Express instance

Server =.\SQLExpress; AttachDbFilename =c:\mydbfile.mdf; Database =dbname; Trusted_Connection =Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

Attach a database file, located in the data directory, on connect to a local SQL Server Express instance

Server =.\SQLExpress; AttachDbFilename =|DataDirectory|mydbfile.mdf; Database =dbname; Trusted_Connection =Yes;

Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.

Using an User Instance on a local SQL Server Express instance

The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer.

Data Source =.\SQLExpress; Integrated Security =true; AttachDbFilename =|DataDirectory|\mydb.mdf; User Instance =true;

To use the User Instance functionality you need to enable it on the SQL Server. This is done by executing the following command: sp_configure 'user instances enabled', '1'. To disable the functionality execute sp_configure 'user instances enabled', '0'.

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

Data Source =myServerAddress; Failover Partner =myMirrorServerAddress; Initial Catalog =myDataBase; Integrated Security =True;


Tuesday, September 13, 2011

code for sending simple mail in .net

first of add the two namespaces i.e are folowing.

using System.Net;
using System.Net.Mail;
///////on send button click
{

SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromAddress = new
MailAddress("mithilesh25@gmail.com", "chandan");

smtpClient.Host = "smtp.gmail.com";
smtpClient.Port = 587;
smtpClient.EnableSsl = false;
smtpClient.Credentials = new
NetworkCredential("mithilesh25@gmail.com","chandan") ;





message.From = fromAddress;
message.To.Add("mithilesh25@gmail.com");
message.Subject = "Feedback";

message.IsBodyHtml = false;
message.Body = "Body";
smtpClient.Send(message);

// = "Mail Sent Successfully";
}
catch(Exception ex)
{
// = "Not Mail Sent Successfully";
Response.Write(ex.Message);
}
}

code of add flash to aspx page

first visit http: //www.html-color-codes.info/

and then open online Free HTML Editor a link which in last part of this website.

click o0n media and select any .swf file and paste url of that .swf file into flash url .


and click html,,that provides code with a flash file in html form,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Wednesday, August 24, 2011

uses of user defined functions and transaction in sql server

create database mithilesh

create table mth(mid int,ename varchar(50),ecity varchar(50),emob varchar(max))

insert into emp values(1,'mithiles','varansi','546546')

select * from emp

/* craete user defined function*/

create function fn(@a int)

returns varchar(50)

as begin

return (select ename from emp where eid =@a)

end

/*for user defined function call*/

select master.dbo.fn(1)

output:-

mithiles

/* inline tables udf return a table that was create dby a single select statement.*/

/* create inline table user defined function*/

/*do not use begin and end on creation of inline tables udf*/

/* its a function which returns a whole tables named "mth".*/

create function func()

returns table

as

return (select * from mth)

/* calling of inline tables udfs*/

select * from master.dbo.func()

output:-

1 a b c

2 d e f

3 g h i

/* transaction sql server*/

use master

select * from emp

select * from mth

alter proc pr

as

begin tran

declare @i int

update emp set ecity='ghazipur' where eid=1

select @i=@@error

if(@i<>0) goto problem

update mth set ename='varun' where mid=2

select @i=@@error

if(@i<>0) goto problem

commit tran

problem:

if(@i<>0)begin

print 'error'

rollback tran

return 1

end

exec pr

Wednesday, August 3, 2011

Code for store and fetching image from database in ms access.

//// its code for store image in ms access database ,,,first make datatype of image as oledb object if u r using oledb.


MemoryStream msStream = new MemoryStream();
if (txtImage.Text == "")
{
pictureBox1.Image = Image.FromFile(@"D:\DataPresales\Layouts\NoImageAvailable.jpeg");
//pictureBox1.Image = resizeImage(pictureBox1.Image, PicWidth, PicHeight);
pictureBox1.Image.Save(msStream, System.Drawing.Imaging.ImageFormat.Bmp);
//pictureBox1.Image.Save(msStream, pictureBox1.Image.RawFormat);

byte[] data = msStream.GetBuffer();
ob.Photo = data;


}






// its code for fetching image from ms access database,,,,,,



byte[] PreImage = (byte[])ds.Tables[0].Rows[0]["Photo"];
MemoryStream ms = new MemoryStream(PreImage);
pictureBox1.Image = Image.FromStream(ms);


// where ds is object of Dataset in which we are fetching whole data.and "Photo" is column name for image.

Monday, July 25, 2011

Payment Gateway with paypal in asp.net with c#

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 com.paypal.sdk.profiles;

using com.paypal.sdk.services;

using com.paypal.sdk.services;

using log4net;

public partial class PaypalPayment : System.Web.UI.Page

{



protected void Page_Load(object sender, EventArgs e)

{

CallerServices caller = new CallerServices();

IAPIProfile profile = ProfileFactory.CreateAPIProfile();

profile.APIUsername ="nitin._1214308341_biz_api1.gmail.com";//
"sdk-seller_api1.sdk.com";

profile.APIPassword ="1214308348";// "12345678";

profile.Environment ="sandbox";

profile.Subject ="";

profile.APISignature ="A5GwH2U8prt9wuPnGmlizZVpeMthAn39AxoXc.I0NyrkrNlL8dUfnjII";

caller.APIProfile = profile;

com.paypal.soap.api.DoDirectPaymentRequestDetailsType directPaymentDetails =
new com.paypal.soap.api.DoDirectPaymentRequestDetailsType();



//Set Credit Card

com.paypal.soap.api.CreditCardDetailsType cc = new
com.paypal.soap.api.CreditCardDetailsType();

cc.CreditCardType = com.paypal.soap.api.CreditCardTypeType.Visa;

cc.CreditCardNumber ="4111111111111111";

cc.ExpMonth=10;

cc.ExpYear = 2009;

cc.CVV2 ="123";

//Set Credit Card.CardOwner

com.paypal.soap.api.PayerInfoType theCardOwner = new
com.paypal.soap.api.PayerInfoType();

com.paypal.soap.api.PersonNameType thePayerName = new
com.paypal.soap.api.PersonNameType();

thePayerName.FirstName ="John";

thePayerName.LastName ="Doe";

theCardOwner.PayerName = thePayerName;

com.paypal.soap.api.AddressType theAddress = new
com.paypal.soap.api.AddressType();

theAddress.Street1 ="123 Main";

theAddress.Street2 ="Apt 23";

theAddress.CityName ="Hill Side";

theAddress.StateOrProvince ="FL";

theAddress.PostalCode ="32550";

theAddress.Country = com.paypal.soap.api.CountryCodeType.US;

theCardOwner.Address = theAddress;

cc.CardOwner = theCardOwner;

directPaymentDetails.CreditCard = cc;

//Set Order Total

com.paypal.soap.api.BasicAmountType temp = new
com.paypal.soap.api.BasicAmountType();

com.paypal.soap.api.PaymentDetailsType payDetailType = new
com.paypal.soap.api.PaymentDetailsType();

temp.Value ="118.25";

temp.currencyID =
com.paypal.soap.api.CurrencyCodeType.USD;payDetailType.OrderTotal = temp;

directPaymentDetails.PaymentDetails = payDetailType;

//Set IP

directPaymentDetails.IPAddress ="192.168.200.195";

//Set Transaction Type

directPaymentDetails.PaymentAction =
com.paypal.soap.api.PaymentActionCodeType.Sale;



//Set Request

com.paypal.soap.api.DoDirectPaymentRequestType request = new
com.paypal.soap.api.DoDirectPaymentRequestType();



//Set Payment Detail

request.DoDirectPaymentRequestDetails = directPaymentDetails;



request.DoDirectPaymentRequestDetails.CreditCard.CardOwner.Address.CountrySpecified
=true;

com.paypal.soap.api.DoDirectPaymentResponseType response =
(com.paypal.soap.api.DoDirectPaymentResponseType)caller.Call("DoDirectPayment"

, request);

Response.Write("response=" + response.Ack);

Response.Write(

"

response=" + response.Errors[0].LongMessage.ToString() + " - " +
response.Errors[0].ErrorCode.ToString());

Tag: paypal, soap, add paypal, simple add paypal, step by step add paypal, paypal sample code in c#.net asp.net, paypal soap request api do direct payment c# request, paypal sdk asp.net items, com.paypal.sdk.profiles for asp.net

Sunday, July 17, 2011

All Asp Data control uses in one program code

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//bind();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("Id");
dt.Columns.Add("Name");
dt.Columns.Add("City");
ds.Tables.Add(dt);
if (ds.Tables[0].Rows.Count == 0)
{
DataRow dr = dt.NewRow();
dr[0] = "1";
dr[1] = "mithilesh";
dr[2] = "varanasi";


dt.Rows.Add(dr);
//ds.Tables.Add(dt);
}
GridView2.DataSource = dt;
GridView2.DataBind();


}



}
public void bind()
{
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
cn.Open();
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("select * from emp", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
//GridView1.DataSource = dt;
//GridView1.DataBind();
//Repeater1.DataSource = dt;
//Repeater1.DataBind();
//DataList1.DataSource = dt;
//DataList1.DataBind();
//DetailsView1.DataSource = dt;
//DetailsView1.DataBind();
//FormView1.DataSource = dt;
//FormView1.DataBind();
//ListView1.DataSource = dt;
//ListView1.DataBind();

}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
//SqlConnection cn = new SqlConnection();
//cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
//cn.Open();
//int i=Convert.ToInt32(GridView1.SelectedIndex);
//int id = Convert.ToInt32(GridView1.Rows[i].Cells[0].Text);

//string a = GridView1.Rows[i].Cells[1].Text;
//string b = GridView1.Rows[i].Cells[2].Text;
//string c = GridView1.Rows[i].Cells[3].Text;
//TextBox1.Text = id.ToString();
//TextBox2.Text = a.ToString();
//TextBox3.Text = b.ToString();
//TextBox4.Text = c.ToString();
//bind();




}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
//GridView1.EditIndex = e.NewEditIndex;
//bind();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//SqlConnection cn = new SqlConnection();
//cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
//cn.Open();

//int id = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[0].Text);
//SqlCommand cmd = new SqlCommand("delete from emp where eid='" + id + "'",cn);
//cmd.ExecuteNonQuery();
//bind();

}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
//GridView1.EditIndex = -1;
//bind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)

{
// SqlConnection cn = new SqlConnection();
// cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
// cn.Open();
// Int32 id = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text);
// string a = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
// string b = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;

//string c = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
// SqlCommand cm = new SqlCommand("update emp set enmae='" + a + "',ecity='" + b + "',econtact='" + c + "' where eid='" + id + "'", cn);

// cm.ExecuteNonQuery();
// GridView1.EditIndex = -1;
// bind();



}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{

}
protected void TextBox3_TextChanged(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
//SqlConnection cn = new SqlConnection();
//cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
//cn.Open();
//SqlCommand cm = new SqlCommand("update emp set enmae='" +TextBox2.Text+ "',ecity='" + TextBox3.Text+ "',econtact='" +TextBox4.Text + "' where eid='" + Convert.ToInt32(TextBox1.Text) + "'", cn);

//cm.ExecuteNonQuery();

//bind();
//TextBox1.Text = "";
//TextBox2.Text = "";
//TextBox3.Text = "";
//TextBox4.Text = "";
foreach (GridViewRow ch in GridView1.Rows)
{
CheckBox c = (CheckBox)GridView1.Rows[ch.RowIndex+1].FindControl("CheckBox1");
if(c.Checked==true)
{
int id = Convert.ToInt32(GridView1.Rows[ch.RowIndex+1].Cells[0].Text);
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
cn.Open();
SqlCommand cm = new SqlCommand("delete from emp where eid='" + id + "'", cn);
cm.ExecuteNonQuery();
bind();

}
}


}
protected void Button2_Click(object sender, EventArgs e)
{
//SqlConnection cn = new SqlConnection();
//cn.ConnectionString = "data source=RANJAN-PC;initial catalog=mithilesh;uid=sa;pwd=chandan;integrated security=false";
//cn.Open();
//SqlCommand cm = new SqlCommand("insert into emp values('" + Convert.ToInt32(TextBox1.Text) + "','" + TextBox2.Text.ToString() + "','" + TextBox3.Text.ToString() + "','" + TextBox4.Text.ToString() + "')", cn);
//cm.ExecuteNonQuery();
//bind();
//TextBox1.Text = "";
//TextBox2.Text = "";
//TextBox3.Text = "";
//TextBox4.Text = "";//int i = 0;
//if (e.CommandName.Equals("delete"))
//{
int i=0;
foreach (RepeaterItem ri in Repeater1.Items)
{
CheckBox c = (CheckBox)ri.FindControl("chk1");
if (c.Checked == true)
{
i = Convert.ToInt32(c);


}

}
Response.Write("total chk is" + i.ToString());
//}


}
protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
{
DetailsView1.PageIndex = e.NewPageIndex;
bind();
}
protected void DetailsView1_PageIndexChanged(object sender, EventArgs e)
{

}
protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
FormView1.PageIndex = e.NewPageIndex;
bind();
}
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
//CheckBox chk = (CheckBox)e.Item.FindControl("chk");
//if (chk.Checked == true)
//{
// Response.Write("check");
//}

}

protected void Button3_Command(object sender, CommandEventArgs e)
{
//int i = 0;
//if (e.CommandName.Equals("delete"))
//{
// foreach (RepeaterItem ri in Repeater1.Items)
// {
// CheckBox c = (CheckBox)ite
// if (c.Checked == true)
// {
// i = i + 1;

// }

// }
// Response.Redirect("total chk is" + i.ToString());
//}
}
}