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
Karthik K
1k
744
193.6k
How to avoid the duplicate Entry ?
Jul 17 2013 2:20 AM
HI To ALL,
I had a problem with duplication entry while trying to Place booking in Booking application.I have dealing with the Calltaxi Booking dispatch application.Here the more than 200 endusers are working this application.when the people trying to press submit in the same time.That BookingNO Get
Duplicate.
Can anyone help me out if possible ...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (obj.BookingNo == "1")
{
objA.BookingNo_Insert(obj.BookingNo, obj.BookingDate);
}
else
{
BookingNo_Update(obj.BookingNo, obj.BookingDate);
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This Is The Function which I have used :
public string BookingNo(DateTime rDate)
{
System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();
dateInfo.ShortDatePattern = "dd/MMM/yyyy";
string dateformat = "dd/MMM/yyyy";
string RequestDate = rDate.ToString(dateformat);
//SqlConnection con = new SqlConnection(connString);
//SqlCommand cmd = new SqlCommand();
OleDbConnection con = new OleDbConnection(connGrid);
OleDbCommand cmd = new OleDbCommand();
con.Open();
string Query = "select BOOKING_NO from TEST_bookingno where REQUEST_DT=to_date('" + RequestDate + "','dd/MON/yy')";
//cmd = new SqlCommand(Query, con);
//SqlDataReader Dr = cmd.ExecuteReader();
cmd = new OleDbCommand(Query, con);
OleDbDataReader Dr = cmd.ExecuteReader();
int r;
try
{
if (Dr.Read())
{
string d = Dr["BOOKING_NO"].ToString();
r = Convert.ToInt32(d);
r = r + 1;
txtBookingNo.Text = r.ToString();
//}
}
else
{
txtBookingNo.Text = Convert.ToString(1);//set the value in textbox which name is id
}
}
catch (Exception ex)
{
BL_ErrorLog objLog = new BL_ErrorLog();
objLog.Write(ex);
}
finally
{
con.Close();
}
return txtBookingNo.Text;
}
**********************************************************************************************
Thanks in advance..
Regard ,
Ernesto Karthik
Reply
Answers (
8
)
Save Function in ADO.NET
MySql - Case -Retrieve data