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.
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


Ravi ShekharRank #673 · 3.6K reputationPosted Jul 16, 2013, 11:15 PM EDT
Try this one using StoredProcedure.
see Sample stored procedure below . . .
Pankaj PandeyRank #642 · 3.7K reputationPosted Jul 16, 2013, 10:27 PM EDT
select BOOKING_NO from TEST_bookingno where REQUEST_DT=to_date('" + RequestDate + "','dd/MON/yy') with no lock.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 16, 2013, 11:04 PM EDT
Try to declare booking no as identity column.
Regards,
Iftikar
Riyaz AkhtarRank #2,275 · 619 reputationPosted Jul 16, 2013, 11:19 PM EDT
if yes , use OnClientClick event in ur button and write a javascript function to check if button is pressed second time. if button is pressed second time then dont let button submit.
try below sample code:
button:
add on hidden field in ur aspx,
javascript:
Karthik KRank #1,981 · 738 reputationPosted Jul 17, 2013, 9:23 PM EDT
First i am glad to your Reply regarding my Post ..But That Particular Procedure which was working sql properly , it is not working in Oracle...
I just attatched that Procedure find it..
Guide me any procedure for Oracle ..
Thanks in advance
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 17, 2013, 10:24 PM EDT
First you run a query...
select BookingId from mBrand where BookingId=@BookingId
and bind result with datatable.
now check your dt if dt.rows.count>0
then update query.........
else
Insert Query
Karthik KRank #1,981 · 738 reputationPosted Jul 18, 2013, 12:12 AM EDT
Dear Ravi ,
My problem has been solved. its working Fine..i Got solution for my Long days issue
THANKS YOU SO MUCH ...
Regards ,
- Karthik
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 18, 2013, 12:47 AM EDT