G
Guest
hey guys this may not be possible, but i have an if statement that checks to
see if a value returned by a sql query is null or not..if it is i execute the
right code if it has a value i need to tell the user about the problem. i was
thinking just an alert box, but i dont know how to do that from the
codebehind aside from asigning it to the buttons onclick event, but the
button already has a confirm box in its onclick.
try {
myConnection = new SqlConnection(connectionString);
myConnection.Open();
cmdIsMaster = new SqlCommand("Select MasterPIN From PIN Where PIN="+PIN,
myConnection);
myReader = cmdIsMaster.ExecuteReader();
myReader.Read();
if(myReader.GetInt32(0).ToString() != null)
{
myReader.Close();
alert("This PIN has a Master that is not active please reactivate
MasterPIN"+myReader.GetInt32(0).ToString());
Response.Redirect("Default.aspx");
}
else
now for some reason the person who had this job before me, put the events in
a switchboard.aspx file and in its codebehind instead of using the codebehind
of default.aspx. i tried putting some of htis code in the default.aspx.cs
file but it wouldnt fire. it works fine in the switchboard.aspx.cs file when
you could delete or reactivate anything, but my boss wanted me to make sure
they didnt reactivate a subpin w/out the master bieng activated, beacuse the
sub wont work w/out the master.
see if a value returned by a sql query is null or not..if it is i execute the
right code if it has a value i need to tell the user about the problem. i was
thinking just an alert box, but i dont know how to do that from the
codebehind aside from asigning it to the buttons onclick event, but the
button already has a confirm box in its onclick.
try {
myConnection = new SqlConnection(connectionString);
myConnection.Open();
cmdIsMaster = new SqlCommand("Select MasterPIN From PIN Where PIN="+PIN,
myConnection);
myReader = cmdIsMaster.ExecuteReader();
myReader.Read();
if(myReader.GetInt32(0).ToString() != null)
{
myReader.Close();
alert("This PIN has a Master that is not active please reactivate
MasterPIN"+myReader.GetInt32(0).ToString());
Response.Redirect("Default.aspx");
}
else
now for some reason the person who had this job before me, put the events in
a switchboard.aspx file and in its codebehind instead of using the codebehind
of default.aspx. i tried putting some of htis code in the default.aspx.cs
file but it wouldnt fire. it works fine in the switchboard.aspx.cs file when
you could delete or reactivate anything, but my boss wanted me to make sure
they didnt reactivate a subpin w/out the master bieng activated, beacuse the
sub wont work w/out the master.