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

ASP.NET

 
GeneralRe: Line Break in Page.RegisterClientScriptBlock Pin
Yusuf2-May-09 1:10
Yusuf2-May-09 1:10 
Question[Message Deleted] Pin
sahoo.fm1-May-09 23:37
sahoo.fm1-May-09 23:37 
AnswerRe: printing Pin
Ramesh Swaminathan2-May-09 0:05
Ramesh Swaminathan2-May-09 0:05 
Questionhow to get the values of dynamically created textboxes Pin
Ramkumar_S1-May-09 23:21
Ramkumar_S1-May-09 23:21 
AnswerRe: how to get the values of dynamically created textboxes Pin
Yusuf2-May-09 1:12
Yusuf2-May-09 1:12 
Questionaspnet_regsql.exe command to create DB.. Pin
Sr...Frank1-May-09 22:07
Sr...Frank1-May-09 22:07 
AnswerRe: aspnet_regsql.exe command to create DB.. Pin
Ramesh Swaminathan1-May-09 22:24
Ramesh Swaminathan1-May-09 22:24 
QuestionProblem for updating record in asp.net Pin
evaskor1-May-09 17:23
evaskor1-May-09 17:23 
Here is a code I use to update records, but it does not work - tough I do not get any error message.Any idea..


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;


namespace Haas_Login_New
{

public partial class Test : System.Web.UI.Page
{
public int sessionHUID = 5326;
public int roleid = 4;
public SqlConnection dbCon = new SqlConnection("Data Source=.........");
protected void Page_Load(object sender, EventArgs e)
{
SqlDataAdapter ad;
DataSet ds = new DataSet();
string query = "";

query = "select school, address, city, state, district from test1 where school = 'Hello'";
ad = new SqlDataAdapter(query, dbCon);
ad.Fill(ds);

if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
txtSchoolName.Text = Convert.ToString(ds.Tables[0].Rows[0]["school"]);
txtAddress.Text = Convert.ToString(ds.Tables[0].Rows[0]["address"]);
txtCity.Text = Convert.ToString(ds.Tables[0].Rows[0]["city"]);
txtDistrict.Text = Convert.ToString(ds.Tables[0].Rows[0]["district"]);
txtState.Text = Convert.ToString(ds.Tables[0].Rows[0]["State"]);
}


}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlDataAdapter ad;
DataSet ds = new DataSet();
string query = "";

query = "select school from test1 where school = '" + Convert.ToString(txtSchoolName.Text) + "'";
ad = new SqlDataAdapter(query, dbCon);
ad.Fill(ds);

if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
ad = new SqlDataAdapter();
query = "UPDATE test SET citystatezip = '" + Convert.ToString(txtCity.Text) + ","
+ Convert.ToString(txtState.Text) + "' WHERE school = '" + Convert.ToString(txtSchoolName.Text) + "'";
SqlCommand sql = new SqlCommand(query, dbCon);
ad.UpdateCommand = sql;
}
else
{
ad = new SqlDataAdapter();
query = "Insert INTO test1 (school, district, city, state, address) VALUES ('"
+ Convert.ToString(txtSchoolName.Text) + "','"
+ Convert.ToString(txtDistrict.Text) + "','"
+ Convert.ToString(txtCity.Text) + "','"
+ Convert.ToString(txtState.Text) + "','"
+ Convert.ToString(txtAddress.Text) + "')";
SqlCommand sql = new SqlCommand(query, dbCon);
ad.InsertCommand = sql;
}



}
}
}
AnswerRe: Problem for updating record in asp.net Pin
Ramesh Swaminathan1-May-09 19:06
Ramesh Swaminathan1-May-09 19:06 
GeneralRe: Problem for updating record in asp.net Pin
evaskor2-May-09 8:33
evaskor2-May-09 8:33 
QuestionProblem accessing a folder Pin
Sweetji1-May-09 8:01
Sweetji1-May-09 8:01 
AnswerRe: Problem accessing a folder Pin
Ramesh Swaminathan1-May-09 19:14
Ramesh Swaminathan1-May-09 19:14 
GeneralRe: Problem accessing a folder Pin
Yusuf2-May-09 1:18
Yusuf2-May-09 1:18 
GeneralRe: Problem accessing a folder Pin
Ramesh Swaminathan2-May-09 1:41
Ramesh Swaminathan2-May-09 1:41 
QuestionHTTP_REFERER question Pin
john_paul1-May-09 7:51
john_paul1-May-09 7:51 
QuestionRe: HTTP_REFERER question Pin
led mike1-May-09 8:36
led mike1-May-09 8:36 
AnswerRe: HTTP_REFERER question Pin
Vega021-May-09 15:45
Vega021-May-09 15:45 
QuestionDatalist: Display page Pin
sameercodes1-May-09 5:28
sameercodes1-May-09 5:28 
QuestionGet Logged in Count Pin
Saamir1-May-09 5:17
Saamir1-May-09 5:17 
AnswerRe: Get Logged in Count Pin
Yusuf1-May-09 5:24
Yusuf1-May-09 5:24 
GeneralRe: Get Logged in Count Pin
Saamir1-May-09 5:31
Saamir1-May-09 5:31 
GeneralRe: Get Logged in Count Pin
Yusuf1-May-09 5:32
Yusuf1-May-09 5:32 
GeneralRe: Get Logged in Count Pin
Saamir1-May-09 5:36
Saamir1-May-09 5:36 
GeneralRe: Get Logged in Count Pin
Yusuf1-May-09 5:53
Yusuf1-May-09 5:53 
GeneralRe: Get Logged in Count Pin
Saamir1-May-09 5:59
Saamir1-May-09 5:59 

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.