TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mohammed shamsheer
NA
394
144.4k
textbox item not inserted in db
Dec 4 2013 12:35 AM
codebehind :
-----------------------------------------------------------------------
public void LoadSave()
{
string Filename = hdnImage.Value;
Employees obj = new Employees();
obj.EmployeeCode = txtCode.Text;
obj.EmployeeName = txtEmployeeName.Text;
obj.ShortName = txtShortName.Text;
obj.Address1 = txtAddress1.Text;
obj.Address2 = txtAddress2.Text;
obj.Address3 = txtAddress3.Text;
obj.StateName = txtStateName.Text;
obj.PIN = txtPIN.Text;
obj.Phone = txtPhone.Text;
obj.Mobile = txtMobile.Text;
obj.Email = txtEmail.Text;
obj.DesignationID = Convert.ToInt64(ddlDesignations.GetId);
obj.AccLedgerID = 1; //Convert.ToInt64(ddlAccLedger.GetID);
obj.Nationality = txtNationality.Text;
obj.Gender = ddlGender.SelectedValue;
obj.BloodGroup = txtBloodGroup.Text;
obj.PassportNo = txtPassportNo.Text;
obj.VisaDetails = txtVisa.Text;
try
{
obj.PassportExpDate = Convert.ToDateTime(txtPassportExpDate.Text, System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
obj.VisaExpDate = Convert.ToDateTime(txtVisaExpiryDate.Text, System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
obj.DOB = Convert.ToDateTime(txtDateOfBirth.Text, System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
obj.DOJ = Convert.ToDateTime(txtDateOfJoining.Text, System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
obj.ResignDate = Convert.ToDateTime(txtResignDate.Text, System.Globalization.CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
}
catch (Exception ex)
{
}
obj.IsResign = ((chkIsResign.Checked) ? true : false);
obj.Qualification = txtQualification.Text;
obj.Notes = txtNotes.Text;
obj.Remarks = txtRemarks.Text;
//obj.EmpImage = Filename;
obj.IsActive = true;
obj.Probotion_Period1 = txtProbotionPeriod.Text;
obj.Temporary1 = Convert.ToBoolean(chkTemprory.Checked ? true : false);
obj.WageType = "Monthly";
int InsId = obj.Save();
}
-------------class files---------------------------
public int Save()
{
// Code Part 1:
//'***** Author: Shamsheer
//'***** Date : 10/08/2013
//'***** This function used to Save Record to table
try
{
object[,] ParmArray;
ParmArray = new object[,]
{
{"@BranchID",General.BRANCHID },
{"@EmployeeCode",EmployeeCode },
{"@EmployeeName",EmployeeName },
{"@ShortName" ,ShortName},
{"@Address1" ,Address1},
{"@Address2",Address2 },
{"@Address3", Address3},
{"@StateName",StateName },
{"@PIN",PIN },
{"@Phone",Phone },
{"@Mobile",Mobile},
{"@Email",Email },
{"@DesignationID",DesignationID} ,
{"@AccLedgerID",AccLedgerID},
{"@Nationality",Nationality},
{"@Gender",Gender},
{"@BloodGroup",BloodGroup},
{"@PassportNo",PassportNo},
{"@PassportExpDate",PassportExpDate},
{"@VisaDetails",VisaDetails},
{"@VisaExpDate", VisaExpDate},
{"@DOB",DOB},
{"@DOJ",DOJ},
{"@IsResign",IsResign},
{"@ResignDate",ResignDate},
{"@Qualification",Qualification},
{"@Notes",Notes},
{"@Remarks",Remarks},
{"@EmpImage",EmpImage},
{"@WindowsEmpImage",WindowsEmpImage},
{"@CreatedUserID",General.USERID},
{"@IsActive",IsActive},
{"@Probotion_Period",Probotion_Period1},
{"@Temporary",Temporary1},
{"@IsPurchaser",IsPurchaser},
{"@IsSalesMan",IsSalesMan},
{"@IsReciept",IsReceipt},
{"@WageType",WageType},
{"@WageAmt",WageAmt}
};
return Convert.ToInt32(DB.ExecuteScalar_SP("InsertEmployees", ParmArray));
}
catch (Exception ex)
{
return 0;
}
}
------------------------------storeprocedur-------------------------------------------
USE [Polosys_ERP]
GO
/****** Object: StoredProcedure [dbo].[InsertEmployees] Script Date: 12/04/2013 10:46:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author
:
MOHAMMED SHAMSHEER
-- Create date: 31/JUL/2013
-- Description:
Return Values
--***
0 if EmployeeName exists ELSE
--
ID on Save
-- =============================================
ALTER PROCEDURE [dbo].[InsertEmployees]
(
@BranchID int,
@EmployeeCode VARCHAR(50),
@EmployeeName VARCHAR(100),
@ShortName VARCHAR(20),
@Address1 VARCHAR(100),
@Address2 VARCHAR(100),
@Address3 VARCHAR(100),
@StateName VARCHAR(50),
@PIN VARCHAR(20),
@Phone VARCHAR(20),
@Mobile VARCHAR(20),
@Email VARCHAR(100),
@DesignationID BIGINT,
@AccLedgerID BIGINT,
@Nationality VARCHAR(50),
@Gender VARCHAR(1),
@BloodGroup VARCHAR(12),
@PassportNo VARCHAR(30),
@PassportExpDate DATETIME,
@VisaDetails varchar(50),
@VisaExpDate DATETIME,
@DOB DATETIME,
@DOJ DATETIME,
@IsResign BIT,
@ResignDate DATETIME,
@Qualification VARCHAR(50),
@Notes VARCHAR(100),
@Remarks VARCHAR(100),
@EmpImage VARCHAR(200),
@WindowsEmpImage VARBINARY(MAX),
@CreatedUserID BIGINT,
@IsActive BIT,
@Probotion_Period VARCHAR(15),
@Temporary BIT,
@IsPurchaser BIT,
@IsSalesMan BIT,
@IsReciept BIT,
@WageType varchar(20),
@WageAmt numeric(18,2)
)
AS
DECLARE @id AS BIGINT
SELECT @id=ISNULL(MAX(EmployeeID),0)FROM Employees
SET @id=@id+1
-- check Employee name exist or not
-- if EmployeeName exist in the employee then return 0 else Perform Save and Return ID
DECLARE @CHECKEmployeeName AS VARCHAR(100)
SELECT @CHECKEmployeeName= EmployeeName FROM Employees WHERE (@EmployeeName=EmployeeName OR EmployeeCode=@EmployeeCode) AND BranchID=@BranchID
IF @CHECKEmployeeName=@EmployeeName
SELECT 0
ELSE
BEGIN
INSERT INTO Employees
(
EmployeeID,
BranchID,
EmployeeCode,
EmployeeName,
ShortName,
Address1,
Address2,
Address3,
StateName,
PIN,
Phone,
Mobile,
Email,
DesignationID,
AccLedgerID,
Nationality,
Gender,
BloodGroup,
PassportNo,
PassportExpDate,
VisaDetails,
VisaExpDate,
DOB,
DOJ,
IsResign,
ResignDate,
Qualification,
Notes,
Remarks,
EmpImage,
WindowsEmpImage,
CreatedUserID,
CreatedDate,
ModifiedUserID,
ModifiedDate,
IsActive,
Probotion_Period,
Temporary,
IsPurchaser,
IsSalesMan,
IsReciept,
WageType,
WageAmt
)
VALUES
(
@id,
@BranchID,
@EmployeeCode,
@EmployeeName,
@ShortName,
@Address1,
@Address2,
@Address3,
@StateName,
@PIN,
@Phone,
@Mobile,
@Email,
@DesignationID,
@AccLedgerID,
@Nationality,
@Gender,
@BloodGroup,
@PassportNo,
@PassportExpDate,
@VisaDetails,
@VisaExpDate,
@DOB,
@DOJ,
@IsResign,
@ResignDate,
@Qualification,
@Notes,
@Remarks,
@EmpImage,
@WindowsEmpImage,
@CreatedUserID,
getdate(),
@CreatedUserID,
getdate(),
@IsActive,
@Probotion_Period,
@Temporary,
@IsPurchaser,
@IsSalesMan,
@IsReciept,
@WageType,
@WageAmt
)
SELECT @id
END
--------------------------------------------------
error showing windowimage is not supplied :
i check for number of parameter,itspelling,itsformat every thing corrrect
i build class file also but again its not working any body have any idea..
Reply
Answers (
3
)
why jtable in web application
how to deploy asp net mvc application