473,320 Members | 1,991 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.

urgent please help

I have the following code but when I build this it gives me errors
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.
SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");

SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);
objCmd.ExecuteNonQuery();
objConn.Close();
Thanks in advance

Apr 16 '07 #1
3 960
On Apr 16, 2:58 pm, bba...@yahoo.com wrote:
I have the following code but when I build this it gives me errors
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.

SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");

SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);

objCmd.ExecuteNonQuery();
objConn.Close();

Thanks in advance
Within the AddWithValue function, enclose your parameter names in
quotes:
objCmd.Parameters.AddWithValue("@username", TextBox1.Text);

Apr 16 '07 #2
You just posted login info for that server on a public message
board...

On Apr 16, 1:58 pm, bba...@yahoo.com wrote:
I have the following code but when I build this it gives me errors
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.

SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");

SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);

objCmd.ExecuteNonQuery();
objConn.Close();

Thanks in advance

Apr 16 '07 #3
On Apr 16, 12:27 pm, "Evan M." <emorgoch.pub...@gmail.comwrote:
On Apr 16, 2:58 pm, bba...@yahoo.com wrote:


I have the following code but when I build this it gives me errors
that username, userpass, userfname does not exist in current context.
I don't know where is the problem and how can I fix this.
SqlConnection objConn = new SqlConnection("Data
Source=sql1300.mssqlservers.com;Initial Catalog=twcsan;Persist
Security Info=True;User ID=twcsan;Password=mln0531");
SqlCommand objCmd = new SqlCommand("UPDATE tbUsers SET
MyName = @username, " +
"MyPass = @userPass, " +
"UserFName = @userfname, " +
"WHERE UserId = 10", objConn);
objConn.Open();
objCmd.Parameters.AddWithValue(@username1, TextBox1.Text);
objCmd.Parameters.AddWithValue(@userPass,
this.TextBox2.Text);
objCmd.Parameters.AddWithValue(@userfname,
this.TextBox3.Text);
objCmd.ExecuteNonQuery();
objConn.Close();
Thanks in advance

Within the AddWithValue function, enclose your parameter names in
quotes:
objCmd.Parameters.AddWithValue("@username", TextBox1.Text);- Hide quoted text -

- Show quoted text -
Thanks a lot

Apr 16 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: js | last post by:
Hi all, I currently encounter a problem and it is urgent to me. After calling the MsgBox.Show(), the message box is shown with non-modal mode, what is the possible reason??? This only happen...
3
by: Liu Ju | last post by:
Dear members: I want to use the multithread in my program which is developed in Visual C++ platform (version 6). I created a controlling function: UINT CCOMM1Dlg::WritingThreadFunc(LPVOID...
2
by: learner | last post by:
Hi, In a page, i have many links. I have some functions in a global file which is included in all linked pages. I want to have a reference to a window which is to be opened on clicking one link...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
2
by: Dimitri | last post by:
PLEASE HELP,I HAVE A DATABSE WITH MULTIPLE RECORDS AS OUTLINED BELOW EMP NO LEVEL NEXTINCREASE WAGETYPE UNIT 1000 1 0 1000 1000 1 0 1002 ...
17
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all...
0
by: Christopher | last post by:
Urgent Help Needed: The EPVH-1.1 Visual Hull Library. Dear All, I am a student doing research in computer vision. The EPVH-1.1 Visual Hull Library will really help a lot in my research. I...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
4
by: ashasivan | last post by:
Hi, Please help me as soon as possible for the following problem. It is very very urgent. I have an XML file as follows: <?xml version="1.0" standalone="yes"?> <Employee> <em...
1
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...

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.