Quantcast
Channel: DataSource Controls - SqlDataSource, ObjectDataSource, etc.
Viewing all articles
Browse latest Browse all 956

SQL Update Statement Error

$
0
0

hi everyone;

I getting annoying with update statement

con.Open();
             Label authorname = e.Item.FindControl("LblAuthorHandler") as Label; //When I Update 1 Column in Record Run perfectly
                 string cmdStrUpdatepoint = "UPDATE Registration SET uPoints +=1  WHERE UserName ='" + authorname.Text +"'";
              // OR
               string cmdStrUpdatepoint = "UPDATE Registration SET TimeRecievePoint ='"+DateTime.Now +"' WHERE UserName ='" + authorname.Text +"'"; //When I Combine Like this "I Got SYNTAX ERROR" //Incorrect syntax near the keyword 'SET'.
 string cmdStrUpdatepoint = "UPDATE Registration SET uPoints +=1, SET TimeRecievePoint ='"+DateTime.Now +"' WHERE UserName ='" + authorname.Text +"'"; 
               SqlCommand cmdUpdatepoint = new SqlCommand(cmdStrUpdatepoint, con);
               cmdUpdatepoint.ExecuteNonQuery();
                Label3.Text = "werw :"+ Session["uNew"].ToString()  ;
                con.Close();


thanks


Viewing all articles
Browse latest Browse all 956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>