Click here to Skip to main content
15,921,028 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Adding Items To Cart Pin
Tim Kohler7-Aug-06 16:40
Tim Kohler7-Aug-06 16:40 
AnswerRe: Adding Items To Cart Pin
NasimKaziS8-Aug-06 2:16
NasimKaziS8-Aug-06 2:16 
QuestionServer side ms mail merge Pin
tmoney1017-Aug-06 14:16
tmoney1017-Aug-06 14:16 
AnswerRe: Server side ms mail merge Pin
minhpc_bk7-Aug-06 15:23
minhpc_bk7-Aug-06 15:23 
QuestionPasswordRecovery control Pin
Clickok7-Aug-06 13:21
Clickok7-Aug-06 13:21 
AnswerRe: PasswordRecovery control Pin
minhpc_bk7-Aug-06 15:24
minhpc_bk7-Aug-06 15:24 
GeneralRe: PasswordRecovery control Pin
Clickok7-Aug-06 15:30
Clickok7-Aug-06 15:30 
QuestionWhat is wrong with this... Pin
NiPsTeRs7-Aug-06 9:41
NiPsTeRs7-Aug-06 9:41 
using System;
using System.Data;
using System.Configuration;
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.SqlClient;

public partial class _Default : System.Web.UI.Page
{
private string _connectionString = ConfigurationSettings.AppSettings["ConnectionString"];

protected void Page_Load(object sender, System.EventArgs e)
{
if (!(Page.IsPostBack))
GetData();
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{

}
#endregion

private void GetData()
{
SqlConnection connection = null;
SqlCommand command = null;
SqlDataReader reader = null;
SqlParameter parameter = null;

try
{
connection = new SqlConnection(_connectionString);
connection.Open();
command = new SqlCommand("select * from nametable where id = @id", connection);
parameter = new SqlParameter("@id", SqlDbType.Int);
parameter.Value = 1;
command.Parameters.Add(parameter);
reader = command.ExecuteReader(CommandBehavior.CloseConnection);

if (reader.HasRows)
{
reader.Read();

nameTextBox.Text = Convert.ToString(reader["name"]);
}
}
catch (Exception ex)
{
// throw;
}
finally
{
if (reader != null)
((IDisposable)reader).Dispose();

if (connection != null)
{
if (connection.State == ConnectionState.Open)
connection.Close();

connection.Dispose();
}
}
}

private void UpdateData()
{
SqlConnection connection = null;
SqlCommand command = null;
SqlParameter parameter = null;

try
{
connection = new SqlConnection(_connectionString);
connection.Open();
command = new SqlCommand("update nametable set Name.name = @Name where id = @id", connection);
parameter = new SqlParameter("@Name", SqlDbType.VarChar);
parameter.Value = nameTextBox.Text;
command.Parameters.Add(parameter);
parameter = new SqlParameter("@id", SqlDbType.Int);
parameter.Value = 1;
command.Parameters.Add(parameter);

command.ExecuteNonQuery();
}
catch (Exception ex)
{

finally
{
if (connection != null)
{
if (connection.State == ConnectionState.Open)
connection.Close();

connection.Dispose();
}
}


protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Label1.Text = nameTextBox.Text;
}
protected void updateButton_Click(object sender, EventArgs e)
{
UpdateData();
}
}



*** i keep getting this stupid message : Error 1 } expected *** pls help
AnswerRe: What is wrong with this... Pin
Guffa7-Aug-06 11:45
Guffa7-Aug-06 11:45 
GeneralRe: What is wrong with this... Pin
eggsovereasy8-Aug-06 3:58
eggsovereasy8-Aug-06 3:58 
GeneralRe: What is wrong with this... Pin
Guffa8-Aug-06 8:07
Guffa8-Aug-06 8:07 
QuestionRemoving Image options Pin
Drathmar7-Aug-06 7:49
Drathmar7-Aug-06 7:49 
AnswerMessage Closed Pin
7-Aug-06 8:13
User-8957237-Aug-06 8:13 
GeneralRe: Removing Image options Pin
Drathmar16-Aug-06 12:39
Drathmar16-Aug-06 12:39 
QuestionWorking with DataList Pin
ravindradonkada7-Aug-06 7:10
ravindradonkada7-Aug-06 7:10 
AnswerRe: Working with DataList Pin
Not Active7-Aug-06 8:51
mentorNot Active7-Aug-06 8:51 
Questionitems added in listbox sorted asc[modified] Pin
bubberz7-Aug-06 3:44
bubberz7-Aug-06 3:44 
AnswerRe: Avoid duplicate items in listbox and sort too Pin
Not Active7-Aug-06 3:59
mentorNot Active7-Aug-06 3:59 
GeneralRe: Avoid duplicate items in listbox and sort too Pin
bubberz7-Aug-06 4:01
bubberz7-Aug-06 4:01 
AnswerRe: items added in listbox sorted asc[modified] Pin
Guffa7-Aug-06 5:00
Guffa7-Aug-06 5:00 
GeneralRe: items added in listbox sorted asc[modified] Pin
bubberz7-Aug-06 5:05
bubberz7-Aug-06 5:05 
AnswerRe: items added in listbox sorted asc[modified] Pin
Guffa7-Aug-06 9:40
Guffa7-Aug-06 9:40 
GeneralRe: items added in listbox sorted asc[modified] Pin
bubberz7-Aug-06 9:42
bubberz7-Aug-06 9:42 
Questioncross-frame scripting Pin
axwiec7-Aug-06 3:27
axwiec7-Aug-06 3:27 
Questionhow to rewrite the URL Pin
Amit Agarrwal7-Aug-06 3:15
Amit Agarrwal7-Aug-06 3:15 

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.