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
Thulasiram pakala
907
872
115.2k
i use this sql and C# code i want to display error message in lable in
Apr 29 2021 9:51 AM
i use this sql and C# code i want to display error message in lable in i get parameter count error what wrong in this query or code any body please help
Alter
Procedure
[dbo].[Proc_ConsumermasterInsert]
(@DCM_DeptName nvarchar(100),
@DCM_Address
varchar
(200),
@DCM_MobileNumber
varchar
(20),
@DCM_CEOName
varchar
(50),
@DCM_EmailID
varchar
(50),
@DCM_DeptDescription
varchar
(200),
@DCM_AddedBy
int
,
@DCM_AddedIPAddress
varchar
(50),
@DCM_Remarks
varchar
(50),
@DCM_Abbrivation
char
(5),
@DCM_CategoryAgencyId
int
,
@DCM_ContactPersonName
varchar
(100),
@DCM_ContactPersonMobileNumber
varchar
(15),
@DCM_ContactPersonEmailID
varchar
(50),
@DCM_ContactPersonLandLineNumber
varchar
(20),
@ERROR
varchar
(500) =
null
--@ERROR varchar(500) out
)
as
begin
DECLARE
@consumerid nvarchar(20)
DECLARE
@getuid nvarchar(20)
begin
try
SET
NOCOUNT
ON
begin
transaction
IF
NOT
EXISTS (
SELECT
DCM_ConsumerID
FROM
[DataConsumerMaster]
WHERE
DCM_DeptName =@DCM_DeptName)
BEGIN
insert
into
[dbo].[DataConsumerMaster] (DCM_DeptName, DCM_Address, DCM_MobileNumber, DCM_CEOName, DCM_EmailID, DCM_DeptDescription,
DCM_DataConsumer, DCM_AddedOn, DCM_AddedBy, DCM_AddedIPAddress, DCM_Status,DCM_Remarks,DCM_EntryMode, DCM_Abbrivation,DCM_CategoryAgencyId,
DCM_ContactPersonName,DCM_ContactPersonMobileNumber,DCM_ContactPersonEmailID,DCM_ContactPersonLandLineNumber)
values
(@DCM_DeptName, @DCM_Address, @DCM_MobileNumber, @DCM_CEOName, @DCM_EmailID, @DCM_DeptDescription,
'A'
, getdate(), @DCM_AddedBy, @DCM_AddedIPAddress,
'A'
,@DCM_Remarks,
'D'
,@DCM_Abbrivation,@DCM_CategoryAgencyId,
@DCM_ContactPersonName,@DCM_ContactPersonMobileNumber,@DCM_ContactPersonEmailID,@DCM_ContactPersonLandLineNumber)
Select
@consumerid = SCOPE_IDENTITY();
set
@getuid = (
Select
DCM_ConsumerID
FROM
DataConsumerMaster
WHERE
DCM_ID = @consumerid)
--Select @getuid= (Select UserName from Logins where Login_ID=@consumerid)
--return @consumerid
IF
NOT
EXISTS (
Select
*
From
Logins
where
Officer_Name=@DCM_CEOName)
BEGIN
Insert
into
Logins(
Password
,UserName,Officer_Name,Officer_Mobile,Email_ID,Type_Of_User,Status,Date_of_Creation,created_by,Date_of_Modification,Roles)
Values
(
'ov2FeiYRwvE='
,
Convert
(nvarchar(50), @getuid) ,@DCM_CEOName,@DCM_MobileNumber,@DCM_EmailID,4,
'Approved'
,
''
,@DCM_AddedBy,
''
,
'C'
)
END
commit
transaction
set
@ERROR =@getuid
--Print @consumerid
return
@ERROR
End
Rollback
transaction
set
@ERROR =
'User Id Allredy Genarated For this Department'
return
@ERROR
end
try
begin
catch
if(@@trancount>0)
begin
set
@ERROR =
'Error !'
/*
'Details Not Saved. Sorry For The Inconvinience.'
*/
return
@ERROR
end
end
catch
END
DataSet dsid =
new
DataSet();
SqlParameter[] arParamsOwners =
null
;
arParamsOwners =
new
SqlParameter[16];
arParamsOwners[0] =
new
SqlParameter(
"@DCM_DeptName"
, System.Data.SqlDbType.VarChar, 100);
arParamsOwners[0].Value = getObjMaster.ApplicationName;
arParamsOwners[1] =
new
SqlParameter(
"@DCM_Address"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[1].Value = getObjMaster.Address;
arParamsOwners[2] =
new
SqlParameter(
"@DCM_MobileNumber"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[2].Value = getObjMaster.MobileNumber;
arParamsOwners[3] =
new
SqlParameter(
"@DCM_CEOName"
, System.Data.SqlDbType.NVarChar, 500);
arParamsOwners[3].Value = getObjMaster.CeoName;
arParamsOwners[4] =
new
SqlParameter(
"@DCM_EmailID"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[4].Value = getObjMaster.EmailID;
arParamsOwners[5] =
new
SqlParameter(
"@DCM_DeptDescription"
, System.Data.SqlDbType.VarChar, 100);
arParamsOwners[5].Value = getObjMaster.ComapnyDescription;
arParamsOwners[6] =
new
SqlParameter(
"@DCM_AddedBy"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[6].Value = getObjMaster.approvedby;
arParamsOwners[7] =
new
SqlParameter(
"@DCM_AddedIPAddress"
, System.Data.SqlDbType.NVarChar, 500);
arParamsOwners[7].Value = getObjMaster.clientip;
arParamsOwners[8] =
new
SqlParameter(
"@DCM_Remarks"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[8].Value = getObjMaster.Remarks;
arParamsOwners[9] =
new
SqlParameter(
"@DCM_Abbrivation"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[9].Value = getObjMaster.Abbrivation;
arParamsOwners[10] =
new
SqlParameter(
"@DCM_CategoryAgencyId"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[10].Value = getObjMaster.Agencycategoryid;
arParamsOwners[11] =
new
SqlParameter(
"@DCM_ContactPersonName"
, System.Data.SqlDbType.NVarChar, 500);
arParamsOwners[11].Value = getObjMaster.PersonName;
arParamsOwners[12] =
new
SqlParameter(
"@DCM_ContactPersonMobileNumber"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[12].Value = getObjMaster.PersonMobileno;
arParamsOwners[13] =
new
SqlParameter(
"@DCM_ContactPersonEmailID"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[13].Value = getObjMaster.PersonEmailid;
arParamsOwners[14] =
new
SqlParameter(
"@DCM_ContactPersonLandLineNumber"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[14].Value = getObjMaster.Personlandline;
arParamsOwners[15] =
new
SqlParameter(
"@ERROR"
, System.Data.SqlDbType.NVarChar, 100);
arParamsOwners[15].Direction = ParameterDirection.Output;
// string message = arParamsOwners["@ERROR"].Value.ToString();
int
Consumer=SqlHelper.ExecuteNonQuery(myConnectionString,
"Proc_ConsumermasterInsert"
, arParamsOwners);
return
Consumer;
Reply
Answers (
1
)
Asp.Net MVC Gridview Query
In ASP.NET, event is the last event that provides scope to control the