V
vncntj
I have a C#.NET that simply passes 6 values to a Stored Procedure. But
I'm trying to get the (Default.aspx.cs page) to handle passing the
values to the sp. The goal is to pass the values and see if any
records are returned. I will later insert some conditional statements.
Here is my Default.aspx.cs
protected void btnNext_Click(object sender, EventArgs e)
{
Session["TotalTimeTo"] = TotalTimeTo.Text;
Session["TotalTimeFrom"] = TotalTimeFrom.Text;
Session["Locations"] = Locations.Text;
Session["Mh"] = Mh.Text;
Session["Dy"] = Dy.Text;
Session["Yr"] = Yr.Text;
Server.Transfer("page3.aspx");
/* Trying to pass to SP*/
string connectionStr =
@"server=localhost;uid=user;pwd=pass;trusted_connection=true;database=Events";
SqlConnection connectObj = new SqlConnection(connectionStr);
commandObj.Connection.Open();
commandObj.ExecuteNonQuery();
commandObj.Connection.Close();
}
Here is my stored procedure*********************
CREATE PROCEDURE CheckAvailableEvents
@Yr nvarchar(4)
,@Mh nvarchar(2)
,@Dy nvarchar(2)
,@Locations nvarchar(50)
,@TotalTimeTo nvarchar(12)
,@TotalTimeFrom nvarchar(12)
As
IF (SELECT Count(TotalTimeTo) from SpecialEvents Where ((Yr = @Yr) AND
(Mh = @Mh) AND (Dy = @Dy))
AND Locations = @Locations AND TotalTimeTo = @TotalTimeTo ) > 0
Select Top 1 Locations, TotalTimeTo, ContactPerson, Extension from
SpecialEvents Where ((Yr = @Yr) AND (Mh = @Mh) AND (Dy = @Dy))
AND Locations = @Locations AND TotalTimeTo = @TotalTimeTo
ELSE
Select Top 0 Locations from SpecialEvents
I get a little lost because a lot of the online tutorials are passing
the values to SqlAdapters!
I'm trying to get the (Default.aspx.cs page) to handle passing the
values to the sp. The goal is to pass the values and see if any
records are returned. I will later insert some conditional statements.
Here is my Default.aspx.cs
protected void btnNext_Click(object sender, EventArgs e)
{
Session["TotalTimeTo"] = TotalTimeTo.Text;
Session["TotalTimeFrom"] = TotalTimeFrom.Text;
Session["Locations"] = Locations.Text;
Session["Mh"] = Mh.Text;
Session["Dy"] = Dy.Text;
Session["Yr"] = Yr.Text;
Server.Transfer("page3.aspx");
/* Trying to pass to SP*/
string connectionStr =
@"server=localhost;uid=user;pwd=pass;trusted_connection=true;database=Events";
SqlConnection connectObj = new SqlConnection(connectionStr);
commandObj.Connection.Open();
commandObj.ExecuteNonQuery();
commandObj.Connection.Close();
}
Here is my stored procedure*********************
CREATE PROCEDURE CheckAvailableEvents
@Yr nvarchar(4)
,@Mh nvarchar(2)
,@Dy nvarchar(2)
,@Locations nvarchar(50)
,@TotalTimeTo nvarchar(12)
,@TotalTimeFrom nvarchar(12)
As
IF (SELECT Count(TotalTimeTo) from SpecialEvents Where ((Yr = @Yr) AND
(Mh = @Mh) AND (Dy = @Dy))
AND Locations = @Locations AND TotalTimeTo = @TotalTimeTo ) > 0
Select Top 1 Locations, TotalTimeTo, ContactPerson, Extension from
SpecialEvents Where ((Yr = @Yr) AND (Mh = @Mh) AND (Dy = @Dy))
AND Locations = @Locations AND TotalTimeTo = @TotalTimeTo
ELSE
Select Top 0 Locations from SpecialEvents
I get a little lost because a lot of the online tutorials are passing
the values to SqlAdapters!