M
Mike T
I'm having a problem with the new ASP.NET 2.0 SqlDataSource object.
(my first time using it)
I placed a SqlDataSouce object on the page and set its connection
properties in the Web.Config. Using the "Configure Datasource..."
wizard, I can browse my tables and stored procedures fine. If I click
on the "..." button in the select property, I can also browse and
configure my select statement.
The page is a simple lookup page, where the user enters the parameter
values for a stored procedure. The stored procedure is called and
returns a recordset, which is displayed with a repeater object.
My search button click event calls Databind on the repeater object. I
have wired the Selecting event of the datasource to modify some of the
parameters of the command object in the datasource. The code that
follows does execute:
protected void dsIDData_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
if (this.txtTimeclock.Text != string.Empty)
{
e.Command.Parameters["@TimeclockID"].Value =
this.txtTimeclock.Text;
e.Command.Parameters["@EmployeeNbr"].Value = DBNull.Value;
}
else
{
e.Command.Parameters["@TimeclockID"].Value = DBNull.Value;
e.Command.Parameters["@EmployeeNbr"].Value =
this.txtEmpName.Text;
}
}
However, if I use the SQL Profiler (SQL 2000), I never see the server
actually run the stored procedure. As a test, I also wired in the
Selected event from the Datasource object, and it is never called.
I've look at this from every angle. Am I missing something?
Thanks for any help you can give me.
Mike
(my first time using it)
I placed a SqlDataSouce object on the page and set its connection
properties in the Web.Config. Using the "Configure Datasource..."
wizard, I can browse my tables and stored procedures fine. If I click
on the "..." button in the select property, I can also browse and
configure my select statement.
The page is a simple lookup page, where the user enters the parameter
values for a stored procedure. The stored procedure is called and
returns a recordset, which is displayed with a repeater object.
My search button click event calls Databind on the repeater object. I
have wired the Selecting event of the datasource to modify some of the
parameters of the command object in the datasource. The code that
follows does execute:
protected void dsIDData_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
if (this.txtTimeclock.Text != string.Empty)
{
e.Command.Parameters["@TimeclockID"].Value =
this.txtTimeclock.Text;
e.Command.Parameters["@EmployeeNbr"].Value = DBNull.Value;
}
else
{
e.Command.Parameters["@TimeclockID"].Value = DBNull.Value;
e.Command.Parameters["@EmployeeNbr"].Value =
this.txtEmpName.Text;
}
}
However, if I use the SQL Profiler (SQL 2000), I never see the server
actually run the stored procedure. As a test, I also wired in the
Selected event from the Datasource object, and it is never called.
I've look at this from every angle. Am I missing something?
Thanks for any help you can give me.
Mike