Question: Table structure is as follows:

```
id int identity
firstname varchar(100) 
lastname varchar(100)

```

I have an detailsview control that displays/inserts/updates firstname lastname on profile.aspx page. 

If customer lands on this page with id in querystring then I want it to load that record into detailsview via sqldatasource and have edit button enabled.

If customer lands on this page with out id in querystring then I want it to display blanks for first/lastname record into detailsview via sqldatasource and have insert button enabled.

How do I accomplish that???

Please help...

Answer: 
Use this method to pop your DetailsView into edit mode if there is an ID passed in: 

```
    Dim theID As Int32 = Request.QueryString("id")
    If Not theID Is Nothing Then
        SqlDataSource.SelectParameters("THE_ID").DefaultValue = theID
        SqlDataSource.DataBind()
        DetailsView.ChangeMode(DetailsViewMode.Edit)
    End If  

```

Just do some additional tweaking for the 'no ID passed in' case.
Read this [Update Databases using ASP.NET 2.0 SqlDataSource](http://www.aspfree.com/c/a/ASP.NET/More-Ways-to-Update-Databases-using-ASPNET-20-SqlDataSource/2/) 

Use the following code to check to see if there is an id passed in if there is populate the fields with his data.

```
int EmpID = 0;

if (Request.Querystring.Get("EmpID") != null) 
{ 
    id = Page.Request.QueryString["EmpID"];
    //load your values
}

```