Adding and Updating

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Rivera

    #1

    Adding and Updating

    I'm new to C# so bear with me.

    I have a windows form with 2 text boxes: First Name and Last Name. I want
    to create a method in my Data class that will handle both my New and Updated
    data(first and last name). This is what I have so far:

    I'm using stored procedures to Insert, Update, and Delete data.
    SqlDataAdapter da = new SqlDataAdapter( "sp_Select" , conn);

    SqlCommandBuild er cb = new SqlCommandBuild er(da);

    da.SelectComman d.CommandType = CommandType.Sto redProcedure;

    DataSet ds = new DataSet();

    da.Fill(ds,"tab le name");

    How do I determine between New and Updated data after I fill my dataset?
    Any help would be appreciated.

    Thanks

    Richard



  • Madhu [MVP]

    #2
    Adding and Updating

    Hi,

    You can use the RowState property of the row.

    Look at the document of RowState Property..

    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-
    us/cpref/html/frlrfsystemdata datarowclassrow statetopic.asp

    Hope this helps...

    Regards,
    Madhu

    MVP | MCSD.NET
    [color=blue]
    >-----Original Message-----
    >I'm new to C# so bear with me.
    >
    >I have a windows form with 2 text boxes: First Name and[/color]
    Last Name. I want[color=blue]
    >to create a method in my Data class that will handle[/color]
    both my New and Updated[color=blue]
    >data(first and last name). This is what I have so far:
    >
    >I'm using stored procedures to Insert, Update, and[/color]
    Delete data.[color=blue]
    >SqlDataAdapt er da = new SqlDataAdapter( "sp_Select" ,[/color]
    conn);[color=blue]
    >
    >SqlCommandBuil der cb = new SqlCommandBuild er(da);
    >
    >da.SelectComma nd.CommandType =[/color]
    CommandType.Sto redProcedure;[color=blue]
    >
    >DataSet ds = new DataSet();
    >
    >da.Fill(ds,"ta ble name");
    >
    >How do I determine between New and Updated data after I[/color]
    fill my dataset?[color=blue]
    >Any help would be appreciated.
    >
    >Thanks
    >
    >Richard
    >
    >
    >
    >.
    >[/color]

    Comment

    Working...