Editing or updating a column in a data table

  • 12 years ago

    Hi! guys. Sad  How do I update the datatable with a new value? Sad 

    using
    (SqlDataAdapter da = new SqlDataAdapter(sql, sqlConn)){

    da.Fill(dt);

    dt.Columns["outgoing"].ToString()= DateValue1;

    dt.Columns["ingoing"].ToString()= DateValue2;

     

    dt.AcceptChanges();

     

    }

  • 12 years ago

    is the value taken from a textbox or other control ? if you want to set the value manually, the SQL command for updating value is given below:

    string sqlStmt;

    sqlStmt= "UPDATE table_name SET column_name= value WHERE column_name=value";

    for e.g. if you want the value of employee_number column to 2 where employee_telephone is 3 in employee table...then

    sqlStmt= "UPDATE employee SET employee_number= 2 WHERE employee_telephone=3";

  • 12 years ago

    Yah! Cool, but i was looking for something like this 

    DataRow[] Row = dt.Select("outgoing '"= txtid.Text +"'" );

    Row[0]["AllowAccess"] = chkperm.CheckState ;

    dt.AcceptChanges();

  • 12 years ago
    Hi, I am facing problem to pass string value from first aspx page to second aspx page pls help me how we pass this value Ashok 09415818455
  • 12 years ago
    check out the following link maybe it will help you: http://authors.aspalliance.com/kenc/passval.aspx also, try searching in google, you will find a lot of answers there. you may search "passing value from one aspx page to another"

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“You can stand on the shoulders of giants OR a big enough pile of dwarfs, works either way.”