Note that there are some explanatory texts on larger screens.

plurals
  1. PODo I have to create a datasource in aspx? Can I do sqldatasource (sql SPROC), parameters and databind in C#
    primarykey
    data
    text
    <p>First, I'll apologize for a newbie question, but I can't seem to find a good example of what I need to do. I have been having trouble with datatypes and my stored procedures when I attempt to create a sqlDataSource in my aspx page and assign session parametersof type int. I wanted to try to do the whole thing in the codebehind so it is easier to debug. It just seems very confusing to me to do part of the work in the aspx, and part in the codebehind. I would be interested in hearing oppinions on this, but I have code here that shows the current state of my attempt. Could you possibly help me get it working?</p> <pre><code>protected void DoReport() { int ClinicID = Convert.ToInt32(Session["selectedClinic"]); String connstr = System.Configuration.ConfigurationManager.ConnectionStrings ["PC3PaymentConnection"].ConnectionString; using (SqlConnection conn = new SqlConnection(connstr)) { using ( SqlCommand cmdMeasureHist = new SqlCommand("GetMeasureDetailHistory", conn)) { cmdMeasureHist.CommandType = CommandType.StoredProcedure; SqlParameter pclinic = cmdMeasureHist.Parameters.Add("@ClinicID", SqlDbType.Int); pclinic.Value = ClinicID; SqlParameter pCMSMID = cmdMeasureHist.Parameters.Add("@CMMeasureID", SqlDbType.Int); pCMSMID.Value = Convert.ToInt32(ddMeasures.SelectedValue); SqlDataSource DsMeasureHist = new SqlDataSource(); gvHistory.DataSourceID = "DsMeasureHist"; conn.Open(); DsMeasureHist.ExecuteNonQuery(); gvHistory.DataBind(); } </code></pre> <p>I just don't understand how to hook the command to the datasource to the gridview. Please help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload