Currently I'm doing an insert into the db from codebehind with a sqldatasource in the following way.
SqlDataSource13.InsertParameters["name"].DefaultValue = ufn;
SqlDataSource13.InsertParameters["mime_type"].DefaultValue = FileUpload1.PostedFile.ContentType;
SqlDataSource13.InsertParameters["size"].DefaultValue = FileUpload1.PostedFile.ContentLength.ToString();
SqlDataSource13.InsertParameters["extension"].DefaultValue = "";
SqlDataSource13.InsertParameters["date"].DefaultValue = dt.ToShortDateString();
SqlDataSource13.InsertParameters["type"].DefaultValue = ddlDocType.SelectedValue;
SqlDataSource13.InsertParameters["description"].DefaultValue = tbDescription.Text;
SqlDataSource13.Insert();
This is working fine. However I need to now get the insert id. I added select scope_identity to the end of the insert query. and the parameter to the insertparameters with direction=ouput.
SELECT @id = SCOPE_IDENTITY()
<asp:Parameter Name="id" Direction="Output" />
however I need to figure out how to get the output parameter with the setup i have above.