473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Asp .Net: How to update database row

hi
i want to place all the values of a paticular login member and i want to update his informatin,
for example i want to update his phone no. and address etc..how can i do that ,right now iam developin web application by C#
,please sught out my problem.

thank you in advance
raghu
Dec 3 '07 #1
4 8832
Shashi Sadasivan
1,435 Expert 1GB
what have you done as yet that is not updating the details for you?
A little bit of code here would help us find out why your code isint updating the database.

You can also use teh debugger to trace the same
Dec 3 '07 #2
what have you done as yet that is not updating the details for you?
A little bit of code here would help us find out why your code isint updating the database.

You can also use teh debugger to trace the same
just check my code

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("user id=sa;password=vubrain;database=raghu;data source=vubrain4");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "userlogin";
cmd.CommandType = CommandType.Text;
SqlParameter para1;
SqlParameter para2;
SqlParameter para3;
SqlParameter para4;
SqlParameter para5;
SqlParameter para6;
SqlParameter para7;
SqlParameter para8;
SqlParameter para9;
para1=cmd.Parameters.AddWithValue("loginname",t5.T ext);
para2 = cmd.Parameters.AddWithValue("loginaddress", tb1.Text);
para3 = cmd.Parameters.AddWithValue("logincity", t6.Text);
para4 = cmd.Parameters.AddWithValue("loginpostalcode", t7.Text);
para5 = cmd.Parameters.AddWithValue("loginphone", t8.Text);
para6 = cmd.Parameters.AddWithValue("loginfax", t9.Text);
para7 = cmd.Parameters.AddWithValue("loginmobile", t10.Text);
para8 = cmd.Parameters.AddWithValue("loginemail", t11.Text);
para9 = cmd.Parameters.AddWithValue("loginwebsite", t12.Text);
int intnum;
con.Open();
intnum = cmd.ExecuteNonQuery();
if (intnum > 0)
{
Label2.Text = "updated successfully";

}
else
{
Label2.Text = "updarted failed";
}
con.Close();
Dec 3 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
Hi,
following is the line which is wrong.

cmd.CommandText = "userlogin";

This should have the update query in sql !!!
Has to be an update query like
"Update usertable Set name = @paramName, pwd = @password where userid = @userID"

And add params accordingly!
parameters are represnted by the @ symbol
Dec 3 '07 #4
hi shashi thankyou for your reply
but i did small coding in which i can update the table but it is updating every one's information but i want to update the profile only that person who logedin
just go through my codding and make any changes

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("user id=sa;password=vubrain;database=raghu;data source=vubrain4");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "update userlogin set loginname='"+t5.Text+"',loginaddress='"+tb1.Text+" ',logincity='"+t6.Text+"',loginfax='"+t9+"' where loginuser=loginuser";
con.Open();
cmd.ExecuteNonQuery();
con.Close();


}

thank you in advance
Dec 4 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
1
by: Viktor Popov | last post by:
Hi , I have a form in which I show UserInfo from the DataBase using Stored Procedure and I populate 5 TextBox controls with this information in this way: private void Page_Load(object sender,...
2
by: Joe Fetters via .NET 247 | last post by:
Have googled and read the VS.NET documentation can't seem to getthe answer to the following. Environment: Framework 1.1 VB.NET WinForm Access database Using all automagic tools (DataAdapter...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
5
by: James | last post by:
Hi, I working on an ASP .NET project, in this project I need to link my project with another program to retrieve data, how can I do that? I have access to source code of the other program where...
1
by: r2destini | last post by:
Hi Friends, I am new to .Net. So I don't know much. I am facing a problem in updating database through ADO.Net I am creating the dataset and there is no problem in the updation and...
5
by: Brad Baker | last post by:
I'm trying to write a simple asp.net page which updates some data in a SQL database. At the top of the page I have the following code: <%@ Page Language="C#" Debug="true" %> <%@ import...
0
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
5
by: John | last post by:
I have an ASP.NET 2.0 application developed in VB.net, that accesses an Microsoft Access database. When the database is on the same IIS server all works just fine. BUT when it tried to access the...
2
by: TonyJ | last post by:
Hello! I use VS2005 and C#. I'm looking at ADO.NET and have found some test tutorial on microsoft MSDN. It can be found on google when searching for "Walkthrough: Saving Data to a Database...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.