Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 problems

Status
Not open for further replies.

UKmedia

Programmer
Nov 2, 2002
90
Code:
Dim strSQL As String
strSQL = "UPDATE tblauth SET "
strSQL = strSQL & "email='" & txtEmail.Text & "',"
strSQL = strSQL & "telephone='" & txtTelephone.Text & "',"
strSQL = strSQL & "mobile='" & txtMobile.Text & "'"
strSQL = strSQL & " WHERE username='" & Session("UserName") & "'"
SQLExecute(strSQL)

I have placed in SQL and run it and no problems but within my webpage it reports that it has run with no errors and I dunno why!

UKmedia productions
 
1.) What exactly are you saying? It works, doesn't work, errors, no errors? you need to be more clear.


2.) don't use inline sql, use stored procedures.
 
like benson said, you need to be more descriptive than "it doesn't work". here is a simple example of what should be happening.
Code:
using(SqlConnection connection = new SqlConnection(...))
{
	connection.Open();
	using(SqlCommand command = connection.CreateCommand())
	{
	      command.CommandText = "UPDATE tblauth SET email=@email, telephone=@telephone, mobile=@mobile WHERE username=@user";
	      command.AddParameterWithValue("email",txtEmail.Text);            
	      command.AddParameterWithValue("telephone",txtTelephone.Text);
	      command.AddParameterWithValue("mobile",txtMobile.Text);
	      command.AddParameterWithValue("user",Session["UserName"]);
	      command.ExecuteNonQuery();
	}
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top