Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regarding file path wildcards Pin
Luc Pattyn9-Mar-12 9:47
sitebuilderLuc Pattyn9-Mar-12 9:47 
GeneralRe: Regarding file path wildcards Pin
PIEBALDconsult9-Mar-12 10:08
mvePIEBALDconsult9-Mar-12 10:08 
AnswerRe: Regarding file path wildcards Pin
Luc Pattyn9-Mar-12 10:13
sitebuilderLuc Pattyn9-Mar-12 10:13 
GeneralRe: Regarding file path wildcards Pin
PIEBALDconsult9-Mar-12 10:20
mvePIEBALDconsult9-Mar-12 10:20 
AnswerRe: Regarding file path wildcards Pin
Luc Pattyn9-Mar-12 10:33
sitebuilderLuc Pattyn9-Mar-12 10:33 
GeneralRe: Regarding file path wildcards Pin
PIEBALDconsult9-Mar-12 10:41
mvePIEBALDconsult9-Mar-12 10:41 
GeneralRe: Regarding file path wildcards Pin
PIEBALDconsult9-Mar-12 15:37
mvePIEBALDconsult9-Mar-12 15:37 
GeneralRe: Regarding file path wildcards Pin
Luc Pattyn9-Mar-12 15:41
sitebuilderLuc Pattyn9-Mar-12 15:41 
GeneralRe: Regarding file path wildcards Pin
PIEBALDconsult9-Mar-12 16:51
mvePIEBALDconsult9-Mar-12 16:51 
QuestionMessage Removed Pin
9-Mar-12 8:18
nassimnastaran9-Mar-12 8:18 
AnswerRe: How to input in DataGridView cell Only Double ... or ... Pin
Ravi Bhavnani10-Mar-12 4:53
professionalRavi Bhavnani10-Mar-12 4:53 
GeneralRe: How to input in DataGridView cell Only Double ... or ... Pin
nassimnastaran10-Mar-12 8:11
nassimnastaran10-Mar-12 8:11 
QuestionCommand Question Pin
Kevin Marois9-Mar-12 7:01
professionalKevin Marois9-Mar-12 7:01 
Questionlistview Pin
abiir9-Mar-12 5:53
abiir9-Mar-12 5:53 
AnswerRe: listview Pin
Dave Kreskowiak9-Mar-12 7:14
mveDave Kreskowiak9-Mar-12 7:14 
AnswerRe: listview Pin
Abhinav S9-Mar-12 15:45
Abhinav S9-Mar-12 15:45 
Questionstreaming video with c# Pin
sileen_Mohammad9-Mar-12 5:32
sileen_Mohammad9-Mar-12 5:32 
AnswerRe: streaming video with c# Pin
Abhinav S9-Mar-12 5:37
Abhinav S9-Mar-12 5:37 
GeneralRe: streaming video with c# Pin
sileen_Mohammad10-Mar-12 8:37
sileen_Mohammad10-Mar-12 8:37 
QuestionC# ASP.net Update Data into a SQL server database Pin
Mike9889-Mar-12 4:52
Mike9889-Mar-12 4:52 
Hi, I have a problem with my homework assignment.
I am able to access the database and insert new customer but it doesn't work when i try to update any record.
if anyone can tell me what is wrong with my code.
thank you so much

this is all my code

C#
 protected void btnUpdate_Click(object sender, EventArgs e)
    {
<big>//this is my problem//</big>
 

        if (Request.QueryString["id"] != null)
        {
            
                        
                 //Declare the connection object
                 SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyLocal"].ConnectionString);
 
                 //Make the connection 
                 Conn.Open();
 
                 //Define you query
              
              
                 string sql = "UPDATE [Customer] SET [FirstName] = @FirstName,  [LastName] = @LastName, [Email] = @Email, [Password] = @Password, [Address1] = @Address1, [Address2] = @Address2, [City] = @City, [State] = @State, [zip] = @zip, [Phone] = @Phone, [Fax] = @Fax  WHERE CustomerID=@CustomerID";
                
                 
                 
                 //Declare the Command
                 SqlCommand cmd = new SqlCommand(sql, Conn);
 
                 //Add the parameters needed for the SQL query
                  cmd.Parameters.AddWithValue("@CustomerID", CustomerID);
                   cmd.Parameters.AddWithValue("@FirstName", txtFirstName.Text);
                  cmd.Parameters.AddWithValue("@LastName", txtLastName.Text);
                  cmd.Parameters.AddWithValue("@Email", txtEmailA.Text);
                  cmd.Parameters.AddWithValue("@Password", txtPasswordA.Text);
                  cmd.Parameters.AddWithValue("@Address1", txtAddress1.Text);
                  cmd.Parameters.AddWithValue("@Address2", txtAddress2.Text);
                   cmd.Parameters.AddWithValue("@City", txtCity.Text);
                  cmd.Parameters.AddWithValue("@State", txtState.Text);
                   cmd.Parameters.AddWithValue("@Zip", txtZip.Text);
                  cmd.Parameters.AddWithValue("@Phone", txtPhone.Text);
                   cmd.Parameters.AddWithValue("@Fax", txtFax.Text);
 

 
                 //Execute the query
 
                 cmd.ExecuteNonQuery();
 
                 Conn.Close();
                 Response.Redirect("Customers.aspx");
             
         
 
        }


modified 9-Mar-12 12:04pm.

AnswerRe: C# ASP.net Update Data into a SQL server database Pin
Wes Aday9-Mar-12 5:29
professionalWes Aday9-Mar-12 5:29 
Generali need help???in c# Pin
amira luis9-Mar-12 0:25
amira luis9-Mar-12 0:25 
GeneralRe: i need help???in c# Pin
OriginalGriff9-Mar-12 0:27
mveOriginalGriff9-Mar-12 0:27 
AnswerRe: i need help???in c# Pin
V.9-Mar-12 1:59
professionalV.9-Mar-12 1:59 
GeneralRe: i need help???in c# Pin
Wes Aday9-Mar-12 3:03
professionalWes Aday9-Mar-12 3:03 

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.