my .aspx file (doctorsignup.aspx)
<%@ Page Language= "C# " MasterPageFile= "~/MasterPage.master " AutoEventWireup= "true " CodeFile= "doctorsignup.aspx.cs " Inherits= "doctorsignup " Title= "Untitled Page " % >
<asp:Content ID= "Content1 " ContentPlaceHolderID= "ContentPlaceHolder1 " Runat= "Server " >
<asp:Label ID= "Label1 " runat= "server " Text= " Register Here "
style= "z-index: 100; left: 256px; position: absolute; top: 202px; width: 303px; "
Font-Names= "Modern " Font-Size= "32pt " ForeColor= "Red " > </asp:Label >
<table style= "z-index: 101; left: 234px; position: absolute; top: 275px; color: #ffffff; font-family: 'Lucida Console '; " >
<tr > <td style= "height: 26px " >Name </td > <td style= "height: 26px " > <asp:TextBox ID= "nametxt " runat= "server " > </asp:TextBox > </td > <td style= "height: 26px; width: 157px; " >
<asp:RequiredFieldValidator ID= "RequiredFieldValidator1 " runat= "server " ErrorMessage= "Enter Name "
Style= "position: relative " ControlToValidate= "nametxt " >* </asp:RequiredFieldValidator > </td > </tr >
<tr > <td >Login Id </td > <td > <asp:TextBox ID= "lidtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " >
<asp:RequiredFieldValidator ID= "RequiredFieldValidator2 " runat= "server " ErrorMessage= "Enter Login Id "
Style= "position: relative " ControlToValidate= "lidtxt " >* </asp:RequiredFieldValidator > </td > </tr >
<tr > <td >Password </td > <td > <asp:TextBox ID= "pwdtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " >
<asp:RequiredFieldValidator ID= "RequiredFieldValidator4 " runat= "server " ControlToValidate= "pwdtxt "
ErrorMessage= "Enter Password " Style= "position: relative " >* </asp:RequiredFieldValidator > </td > </tr >
<tr > <td >Confirm Password </td > <td > <asp:TextBox ID= "conpwdtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " >
<asp:CompareValidator ID= "CompareValidator1 " runat= "server " ControlToCompare= "pwdtxt "
ControlToValidate= "conpwdtxt " ErrorMessage= "Not Matching " Style= "position: relative " >* </asp:CompareValidator > </td > </tr >
<tr > <td >Department </td > <td >
<asp:DropDownList ID= "depddl " runat= "server " Width= "153px " >
<asp:ListItem >----Select---- </asp:ListItem >
<asp:ListItem >Cardiology </asp:ListItem >
<asp:ListItem >Neurology </asp:ListItem >
<asp:ListItem >Opthalmology, </asp:ListItem >
<asp:ListItem >Nephrology </asp:ListItem >
<asp:ListItem >Surgery </asp:ListItem >
<asp:ListItem >Pediatrics </asp:ListItem >
</asp:DropDownList > </td > <td style= "width: 157px " >
<asp:RequiredFieldValidator ID= "RequiredFieldValidator3 " runat= "server " ControlToValidate= "depddl "
ErrorMessage= "Enter Your Department " Style= "position: relative " >* </asp:RequiredFieldValidator > </td > </tr >
<tr > <td >Specialization </td > <td >
<asp:DropDownList ID= "speddl " runat= "server " Width= "154px " >
<asp:ListItem >----Select---- </asp:ListItem >
<asp:ListItem >Pulmonology </asp:ListItem >
<asp:ListItem >Cardiology </asp:ListItem >
<asp:ListItem >Neurology </asp:ListItem >
<asp:ListItem >Nephrology </asp:ListItem >
<asp:ListItem >Opthalmology </asp:ListItem >
</asp:DropDownList > </td > <td style= "width: 157px " >
<asp:RequiredFieldValidator ID= "RequiredFieldValidator5 " runat= "server " ControlToValidate= "speddl "
ErrorMessage= "Specialization " Style= "position: relative " >* </asp:RequiredFieldValidator > </td > </tr >
<tr > <td >Phone Number </td > <td > <asp:TextBox ID= "phtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " > </td > </tr >
<tr > <td >Address </td > <td > <asp:TextBox ID= "addtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " > </td > </tr >
<tr > <td >E-Mail </td > <td > <asp:TextBox ID= "emtxt " runat= "server " > </asp:TextBox > </td > <td style= "width: 157px " >
<asp:RegularExpressionValidator ID= "RegularExpressionValidator1 " runat= "server " ControlToValidate= "emtxt "
ErrorMessage= "Incorrect Format " Style= "position: relative " ValidationExpression= "\w+([-+. ']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* " >* </asp:RegularExpressionValidator > </td > </tr >
</table >
<table style= "z-index: 101; left: 299px; position: absolute; top: 549px; font-weight: bold; color: #ffffff; font-family: 'Lucida Console '; " >
<tr > <td style= "width: 88px " >
<asp:Button ID= "subbtn " runat= "server " Text= "Submit " Width= "94px " OnClick= "subbtn_Click " / > </td >
<td style= "width: 93px " >
<asp:Button ID= "Resbtn " runat= "server " Text= "Reset " Width= "94px " OnClick= "Resbtn_Click " / > </td >
<td style= "width: 93px " >
<asp:Button ID= "canbtn " runat= "server " Text= "Cancel " Width= "94px " OnClick= "canbtn_Click " / > </td > </tr >
</table >
</asp:Content >
.aspx.cs file (doctorsignup.aspx.cs)
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class doctorsignup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected virtual void subbtn_Click(object sender, EventArgs e)
{
try
{
SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Angel\Desktop\Hospital Management System ASP.NET Project\Hospital Management System Source Code\App_Data\ASPNETDB.MDF;Integrated Security=True;User Instance=True");
SqlCommand command = new SqlCommand("sp_hospital_doctorsignup", cn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@name",SqlDbType.VarChar,20).Value = nametxt.Text;
command.Parameters.Add("@loginid",SqlDbType.VarChar,20).Value = lidtxt.Text;
command.Parameters.Add("@password",SqlDbType.VarChar,20).Value = pwdtxt.Text;
command.Parameters.Add("@department",SqlDbType.VarChar,20).Value = depddl.Text;
command.Parameters.Add("@specialization",SqlDbType.VarChar,20).Value = speddl.Text;
command.Parameters.Add("@phonenumber", SqlDbType.BigInt).Value = phtxt.Text;
command.Parameters.Add("@address",SqlDbType.VarChar,40).Value = addtxt.Text;
command.Parameters.Add("@email",SqlDbType.VarChar,20).Value = emtxt.Text;
cn.Open();
return command.ExecuteNonQuery();
cn.Close();
}
catch (SqlException ex)
{
Console.WriteLine("SQL Error" + ex.Message.ToString());
return 0;
}
// the below code is written by me to the stored procedure .its going o stored procedure but its not calling the procedure .so am modifying this block of code with the other code and for a rference am keeeping the below code from here to emtxt in comment lines
Response.Redirect("doctorlogin.aspx");
}
protected void Resbtn_Click(object sender, EventArgs e)
{
Response.Redirect("doctorsignup.aspx");
}
protected void canbtn_Click(object sender, EventArgs e)
{
Response.Redirect("doctorlogin.aspx");
}
}
the stored procedure i used here is
sp_hospital_doctorsignup
ALTER PROCEDURE dbo.sp_hospital_doctorsignup
(
@name varchar(20),
@loginid varchar(20),
@password varchar(20),
@department varchar(20),
@specialization varchar(20),
@phonenumber bigint,
@address varchar(40),
@email varchar(20)
)
as
begin
SET NOCOUNT ON;
begin
insert into hospital_doctorsignup values(@name,@loginid,@password,@department,@specialization,@phonenumber,@address,@email)
end
end
the table i created
hospital_doctorsignup
Table For Doctor Register
create table hospital_doctorsignup
(
name varchar(20),
loginid varchar(20),
password varchar(20),
department varchar(20),
specialization varchar(20),
phonenumber bigint,
address varchar(20),
email varchar(20)
)
friends i had tried lot of blocks f code from code project itself but no one specified the entire code and am a beginner and am quite confused with this code .as u may see in comment lines i had written that its my code .by using that code am able to call the procedure but am not able to store the procedure .when i insert the values in registration form its redirecting me to the doctors login page but its not storing any values in the respective connected table which i had mentioned in the sp_hospital_doctorsignup stored procedure .i want to read the user inputs into the stored procedure .please help me to complete my project .if u wan me to mail my project to u am happy to do that but i want solution before 1st june 2016.please help me friends jus set a page for me .i will try to set other pages.
if u r setting the page plz mention the use of code in the comment line in each line of code.its a request.thanks in advance .thank you
What I have tried:
friends i had tried almost everything but am unable to place the block of code at right place.if u can plz set this page so i can execute the stored procedure and the values into my table hospital_doctorsignup.