try
{
if
(NameTxtBx.Text ==
""
|| ToTxtBx0.Text ==
""
|| DropDownList1.SelectedIndex == 0 || RadioButtonList2.SelectedIndex == 0 || (PatID_NO.Text ==
""
) || (Convert.ToUInt64(PatNo.Text) <= 0) || (Convert.ToUInt64(PatNo.Text) > 200000000))
{
Message(
"Please enter all fields"
,
this
);
return
;
}
else
{
try
{
string
Patient_name = NameTxtBx.Text, Export_TO = ToTxtBx0.Text ;
int
PatNoVal;
PatNoVal = Convert.ToInt32(PatNo.Text);
PatNoVal =
int
.Parse(PatNo.Text);
decimal
PatID =
decimal
.Parse(PatID_NO.Text);
int
? replay_To_type = Int16.Parse(DropDownList1.SelectedValue);
int
? reptype = Int16.Parse(RadioButtonList2.SelectedValue);
try
{
con.Open();
SqlCommand cmd =
new
SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText =
"Transaction"
;
cmd.Parameters.AddWithValue(
"@Patient"
, Patient_name);
cmd.Parameters.AddWithValue(
"@E_TO"
, Export_TO);
cmd.Parameters.AddWithValue(
"@R_type"
, reptype);
cmd.Parameters.AddWithValue(
"@ReportType"
, replay_To_type);
cmd.Parameters.AddWithValue(
"@Patient_no"
, PatNoVal);
cmd.Parameters.AddWithValue(
"@Patient_ID_NO"
, PatID);
cmd.Parameters.AddWithValue(
"@User_name"
, Label1.Text = Session[
"name"
].ToString ());
cmd.Parameters.Add(
"@idcount"
, SqlDbType.Decimal);
cmd.Parameters.Add(
"@ReturnIDcount"
, SqlDbType.NVarChar,50);
cmd.Parameters[
"@ReturnIDcount"
].Direction = ParameterDirection.Output;
cmd.Connection = con;
cmd.ExecuteNonQuery(); <<<--- error
in
this
line
con.Close();
TextBox1.Text = cmd.Parameters [
"@ReturnIDcount"
].Value.ToString();
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(
this
.GetType(),
"IDCount"
,
"alert('YourID is ID :"
+ cmd.Parameters[
"@ReturnIDcount"
].Value.ToString() +
"');"
,
true
);
}
catch
(Exception ex)
{
Message(
"Block 3: Error\nThe Reported fault is:\n"
+ ex.Message,
this
);
}
PatNo.Text =
""
;
NameTxtBx.Text =
""
;
ToTxtBx0.Text =
""
;
DropDownList1.SelectedIndex = -1;
RadioButtonList2.SelectedIndex = -1;
}
catch
{
Message(
" ERROR 20"
,
this
);
}
}
}
catch
{
Message(
"Error: Make sure that you are entering the data properly "
,
this
);
}