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
Rizwan Ahmed
NA
80
13.2k
Generate new id code with alpha and number format
Nov 28 2018 11:35 AM
I create c# project with Access Database and I want to Autogenerated new id (Format as 3 Alphabets 3 Digits) but alphabets change automatically with selection of last form. i tried this but just 1st condition works,
void
NewAppID()
{
try
{
OleDbDataAdapter da =
new
OleDbDataAdapter(
"select [FormCode] from [Booking] order by [FormCode] desc"
, conn);
DataSet ds =
new
DataSet();
da.Fill(ds);
if
(lblProName.Text ==
"Fazal Sun City"
|| ds.Tables[0].Rows.Count > 0)
{
txtFormCode.Text =
"FSC "
+ (
int
.Parse(ds.Tables[0].Rows[0][0].ToString()) + 1).ToString();
}
else
if
(lblProName.Text ==
"Mehran Gold"
|| ds.Tables[0].Rows.Count > 0)
{
txtFormCode.Text =
"MG "
+ (
int
.Parse(ds.Tables[0].Rows[0][0].ToString()) + 1).ToString();
}
else
{
txtFormCode.Text =
"1"
;
}
}
catch
(Exception ex)
{
MetroFramework.MetroMessageBox.Show(
this
,
"Error"
+ ex.Message,
"Stop"
, MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
Reply
Answers (
1
)
What is the difference between toString & Convert. Tostring(
model and repository in C#