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
habib ullah
NA
229
14.2k
how to get a maximum id from database on from load event
Apr 10 2018 12:26 PM
how to get a maximum id from database on from load event and assign the textbox
my storeprocedure is that i am beginer pleae help me
alter PROCEDURE School.GetRegisterationNumber
AS
begin
declare @StudentRegNo int
set @StudentRegNo=(select MAX(StudentRegNo) from School.StudentInformation)
if @StudentRegNo is null
set @StudentRegNo='OXPS-0001'
Return 'OXPS'+'-'+RIGHT('0000'+convert(nvarchar(10),@StudentRegNo),4)
SET @StudentRegNo=SCOPE_IDENTITY()
end
c# code is that
public int GetRegisterAtionNumber()
{
List<SqlParameter> prm = new List<SqlParameter>();
DataSet ds= rp.GetDS("School.GetRegisterationNumber", prm);
DataTable dt = ds.Tables[0];
return 1;
}
form load event is that
tbx.tex= GetRegisterAtionNumber().tostring();
the error is that
Additional information: Conversion failed when converting the nvarchar value 'OXPS-0333' to data type int.
Reply
Answers (
2
)
Convert HTML files in sharepoint document library to PDF
Date wise data search in mvc