Click here to Skip to main content
15,891,670 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: send data to asp.net form when user click the link Pin
dataminers6-Nov-07 12:33
dataminers6-Nov-07 12:33 
Questionhow to fetch contiguous numbers from a string Pin
yogesh_softworld1236-Nov-07 7:22
yogesh_softworld1236-Nov-07 7:22 
AnswerRe: how to fetch contiguous numbers from a string Pin
Christian Graus6-Nov-07 9:21
protectorChristian Graus6-Nov-07 9:21 
GeneralRe: how to fetch contiguous numbers from a string Pin
yogesh_softworld1236-Nov-07 16:19
yogesh_softworld1236-Nov-07 16:19 
AnswerRe: how to fetch contiguous numbers from a string Pin
Guffa6-Nov-07 9:57
Guffa6-Nov-07 9:57 
QuestionMessage box in C# [modified] Pin
Deepak Koduri6-Nov-07 6:30
Deepak Koduri6-Nov-07 6:30 
AnswerRe: Message box in C# Pin
Guffa6-Nov-07 7:52
Guffa6-Nov-07 7:52 
GeneralRe: Message box in C# Pin
Deepak Koduri15-Nov-07 19:52
Deepak Koduri15-Nov-07 19:52 
Hi Guffa.,

How to use this method (Page.ClientScript.RegisterStartupScript)& with which arguments I have to pass in the following code.
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;

public partial class Login : System.Web.UI.Page
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\\Project\\DataBase.mdb;Persist Security Info=False;");
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button2_Click(object sender, EventArgs e)
{
string s = "Select EmpID from Employee where EmpID=@id1;";
con.Open();
OleDbCommand cmd = new OleDbCommand(s, con);
cmd.Parameters.Add("@id1", OleDbType.VarChar);
cmd.Parameters["@id1"].Value = TextBox1.Text;
OleDbDataReader dr;
dr = cmd.ExecuteReader();
if (dr.Read())
{
Response.Write("alert('Employee ID already Exits');");
}
else
{
string s1 = "insert into Employee values(@id1,@id2,@id3,@id4,@id5,@id6,@id7,@id8,@id9,@id10,@id11,@id12,@id13,@id14);";
con.Open();
OleDbCommand cmd1 = new OleDbCommand(s1, con);
cmd1.Parameters.AddWithValue("@id1", TextBox1.Text);
cmd1.Parameters.AddWithValue("@id2", TextBox2.Text);
cmd1.Parameters.AddWithValue("@id3", TextBox3.Text);
cmd1.Parameters.AddWithValue("@id4", TextBox4.Text);
cmd1.Parameters.AddWithValue("@id5", TextBox5.Text);
cmd1.Parameters.AddWithValue("@id6", TextBox6.Text);
cmd1.Parameters.AddWithValue("@id7", ListBox2.Text);
cmd1.Parameters.AddWithValue("@id8", TextBox7.Text);
cmd1.Parameters.AddWithValue("@id9", ListBox5.Text);
cmd1.Parameters.AddWithValue("@id10", ListBox4.Text);
cmd1.Parameters.AddWithValue("@id11", TextBox8.Text);
cmd1.Parameters.AddWithValue("@id12", BasicDatePicker1.Text);
cmd1.Parameters.AddWithValue("@id13", TextBox9.Text);
cmd1.Parameters.AddWithValue("@id14", ListBox3.Text);
cmd1.ExecuteNonQuery();
//Response.Write("alert('Inserted')");
con.Close();
}
}

private void Write(string p)
{
throw new Exception("The method or operation is not implemented.");
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
con.Open();
OleDbCommand cmd = new OleDbCommand("select * from Employee where EmpID=@id1", con);
cmd.Parameters.AddWithValue("@id1", ListBox1.SelectedValue.ToString());
OleDbDataReader dr = cmd.ExecuteReader();
dr.Read();
TextBox1.Text = dr.GetString(0);
TextBox2.Text = dr.GetString(1);
TextBox3.Text = dr.GetString(2);
TextBox4.Text = dr.GetString(3);
TextBox5.Text = dr.GetString(4);
TextBox6.Text = dr.GetString(5);
ListBox2.SelectedValue = dr.GetString(6);
TextBox7.Text = dr.GetString(7);
ListBox5.SelectedValue = dr.GetString(8);
ListBox4.SelectedValue = dr.GetString(9);
TextBox8.Text = dr.GetString(10);
BasicDatePicker1.DayStatusBarText= dr.GetString(11);
TextBox9.Text = dr.GetString(12);
ListBox3.SelectedValue = dr.GetString(13);
con.Close();
}
protected void Button3_Click(object sender, EventArgs e)
{
string s = "Update Employee set Pass=@id2,FName=@id3,LName=@id4,Address=@id5,HomeNo=@id6,Sex=@id7,EmailID=@id8,Designation=@id9,Education=@id10,Skills=@id11,JoinDate=@id12,CProject=@id13,PStatus=@id14 where EmpID=@id1;";
con.Open();
OleDbCommand cmd = new OleDbCommand(s, con);

cmd.Parameters.AddWithValue("@id2", TextBox2.Text);
cmd.Parameters.AddWithValue("@id3", TextBox3.Text);
cmd.Parameters.AddWithValue("@id4", TextBox4.Text);
cmd.Parameters.AddWithValue("@id5", TextBox5.Text);
cmd.Parameters.AddWithValue("@id6", TextBox6.Text);
cmd.Parameters.AddWithValue("@id7", ListBox2.SelectedValue);
cmd.Parameters.AddWithValue("@id8", TextBox7.Text);
cmd.Parameters.AddWithValue("@id9", ListBox5.SelectedValue);
cmd.Parameters.AddWithValue("@id10", ListBox4.SelectedValue);
cmd.Parameters.AddWithValue("@id11", TextBox8.Text);
cmd.Parameters.AddWithValue("@id12", BasicDatePicker1.SelectedDate);
cmd.Parameters.AddWithValue("@id13", TextBox9.Text);
cmd.Parameters.AddWithValue("@id14", ListBox3.SelectedValue);
cmd.Parameters.AddWithValue("@id1", TextBox1.Text);
cmd.ExecuteNonQuery();
//Response.Write("alert('Inserted')");
con.Close();
}
protected void Button4_Click(object sender, EventArgs e)
{
string s = "delete from Employee Where EmpID=@id1;";
con.Open();
OleDbCommand cmd = new OleDbCommand(s, con);
cmd.Parameters.AddWithValue("@id1", TextBox1.Text);
cmd.Parameters.AddWithValue("@id2", TextBox2.Text);
cmd.Parameters.AddWithValue("@id3", TextBox3.Text);
cmd.Parameters.AddWithValue("@id4", TextBox4.Text);
cmd.Parameters.AddWithValue("@id5", TextBox5.Text);
cmd.Parameters.AddWithValue("@id6", TextBox6.Text);
cmd.Parameters.AddWithValue("@id7", ListBox2.Text);
cmd.Parameters.AddWithValue("@id8", TextBox7.Text);
cmd.Parameters.AddWithValue("@id9", ListBox5.Text);
cmd.Parameters.AddWithValue("@id10", ListBox4.Text);
cmd.Parameters.AddWithValue("@id11", TextBox8.Text);
cmd.Parameters.AddWithValue("@id12", BasicDatePicker1.Text);
cmd.Parameters.AddWithValue("@id13", TextBox9.Text);
cmd.Parameters.AddWithValue("@id14", ListBox3.Text);
cmd.ExecuteNonQuery();
//Response.Write("alert('Inserted')");
con.Close();
}
}



Regards.,
Deepak
GeneralRe: Message box in C# Pin
Guffa15-Nov-07 20:39
Guffa15-Nov-07 20:39 
QuestionReadonly Gridview Pin
kjosh6-Nov-07 5:43
kjosh6-Nov-07 5:43 
AnswerRe: Readonly Gridview Pin
John-ph6-Nov-07 21:45
John-ph6-Nov-07 21:45 
Questionhow to update a row in data grid ?? [modified] Pin
rocky8116-Nov-07 4:51
rocky8116-Nov-07 4:51 
AnswerRe: how to update a row in data grid ?? Pin
John-ph6-Nov-07 5:14
John-ph6-Nov-07 5:14 
GeneralRe: how to update a row in data grid ?? Pin
rocky8116-Nov-07 5:20
rocky8116-Nov-07 5:20 
GeneralRe: how to update a row in data grid ?? Pin
John-ph6-Nov-07 5:25
John-ph6-Nov-07 5:25 
GeneralRe: how to update a row in data grid ?? Pin
rocky8116-Nov-07 5:30
rocky8116-Nov-07 5:30 
GeneralRe: how to update a row in data grid ?? Pin
John-ph6-Nov-07 19:21
John-ph6-Nov-07 19:21 
QuestionFormView Problem ASP.NET 2005 Pin
Haridas.R6-Nov-07 4:20
Haridas.R6-Nov-07 4:20 
AnswerRe: FormView Problem ASP.NET 2005 Pin
Rocky#6-Nov-07 4:42
Rocky#6-Nov-07 4:42 
QuestionAjax control toolkit tabcontainer - not rendered Pin
digsy_6-Nov-07 3:40
digsy_6-Nov-07 3:40 
QuestionSorting in a GridView Without Databinding Pin
Rocky#6-Nov-07 3:23
Rocky#6-Nov-07 3:23 
AnswerRe: Sorting in a GridView Without Databinding Pin
John-ph6-Nov-07 4:01
John-ph6-Nov-07 4:01 
GeneralRe: Sorting in a GridView Without Databinding Pin
Rocky#6-Nov-07 4:07
Rocky#6-Nov-07 4:07 
GeneralRe: Sorting in a GridView Without Databinding Pin
Rocky#6-Nov-07 4:40
Rocky#6-Nov-07 4:40 
GeneralRe: Sorting in a GridView Without Databinding Pin
John-ph6-Nov-07 4:58
John-ph6-Nov-07 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.