hi all,
i m making a simple registration form of the student.
for this i writ a stored procedure named as"sp_stuDetails" whose code is as follows
USE [C:\DOCUMENTS AND SETTINGS\HP-ZEZ\MY DOCUMENTS\VISUAL STUDIO 2008\PROJECTS\GETSETGO_CCE\GETSETGO_CCE\CCE.MDF]
GO
CREATE proc [dbo].[sp_stuDetails]
@strSRNo varchar(25),
@datAdmission datetime,
@strName varchar(50),
@strGender varchar(1),
@datBirth datetime,
@strFather varchar(50),
@strMother varchar(50),
@strGaurdian varchar(200),
@strAddress varchar(200),
@strPermanenetAddress varchar(200),
@strContactDetails varchar(200),
@strMobile1 varchar(25),
@strMobile2 varchar(25),
@intCityID int,
@intStateID int,
@intDistrictID int,
@intReturn int=0 output
as
begin
declare @intNextID int
begin transaction
select @intNextID = isnull(max(intStudentID),0)+1 from tblStudent1;
insert into tblStudent1 (
intStudentID,
strSRNo,
datAdmission,
strName,
strGender,
datBirth,
strFather,
strMother,
strGaurdian,
strAddress,
strPermanenetAddress,
strContactDetails,
strMobile1,
strMobile2,
intCityID,
intStateID,
intDistrictID
)
values(
@intNextID,
@strSRNo,
@datAdmission,
@strName,
@strGender,
@datBirth,
@strFather,
@strMother,
@strGaurdian,
@strAddress,
@strPermanenetAddress,
@strContactDetails,
@strMobile1,
@strMobile2,
@intCityID,
@intStateID,
@intDistrictID
)
if @@error <> 0
begin
rollback transaction
return @intReturn
end
commit transaction
set @intReturn = @intNextID
return @intReturn
end
GO
and in .cs file Save button click event i write the code which is as follows...
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["cbsegrade"].ToString());
SqlCommand cmd = new SqlCommand("sp_stuDetails", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Parameters.AddWithValue("@strSRNo", txtSRNo.Text);
cmd.Parameters.AddWithValue("@datAdmission", txtdatAdmission);
cmd.Parameters.AddWithValue("@strName", txtStudentName);
cmd.Parameters.AddWithValue("@strGender", ddlGender.SelectedValue);
cmd.Parameters.AddWithValue("@datBirth", txtDob);
cmd.Parameters.AddWithValue("@strFather", txtFatherName.Text);
cmd.Parameters.AddWithValue("@strMother", txtMotherName.Text);
cmd.Parameters.AddWithValue("@strGaurdian", txtGaurdian.Text);
cmd.Parameters.AddWithValue("@strAddress", txtCurAdd.Text);
cmd.Parameters.AddWithValue("@strPermanenetAddress", txtPerAdd.Text);
cmd.Parameters.AddWithValue("@strContactDetails", txtConDetails.Text);
cmd.Parameters.AddWithValue("@strMobile1", txtMob1.Text);
cmd.Parameters.AddWithValue("@strMobile2", txtMob2.Text);
cmd.Parameters.AddWithValue("@intCityID", ddlCity.SelectedValue);
cmd.Parameters.AddWithValue("@intStateID", ddlState.SelectedValue);
cmd.Parameters.AddWithValue("@intDistrictID", ddlDistrict.SelectedValue);
cmd.ExecuteNonQuery();
con.Close();
but when i run the web form
it gives the following error
No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type.
plz help me out.
thanks and regard
subiya