Saturday 1 September 2012

cmd.Parameters.AddWithValue | insert record in asp.net

  cmd.Parameters.AddWithValue | insert record in asp.net
try
           {
               con.Open();
               //SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(8,456,555)",con);
               SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(@stud_rollno,@paidfee,@remain_fee)", con);
               cmd.CommandType = System.Data.CommandType.Text;
               cmd.Parameters.AddWithValue("@stud_rollno",9);
               cmd.Parameters.AddWithValue("@paidfee",233.4);
               cmd.Parameters.AddWithValue("@remain_fee",4565.34);
               cmd.ExecuteNonQuery();
              //DataTable dt = new DataTable(); 
           }
           catch(Exception ex)
           {
               Response.Write(ex);
           }


            finally
            {
               con.Close();
            }
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: