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 ShekharPosted Jul 17, 2013, 3:15 AM
Try this one using StoredProcedure.
see Sample stored procedure below . . .
Ravi ShekharPosted Jul 18, 2013, 4:47 AM
Karthik KPosted Jul 18, 2013, 4:12 AM
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 ShekharPosted Jul 18, 2013, 2:24 AM
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 KPosted Jul 18, 2013, 1:23 AM
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
Riyaz AkhtarPosted Jul 17, 2013, 3:19 AM
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:
Iftikar HussainPosted Jul 17, 2013, 3:04 AM
Try to declare booking no as identity column.
Regards,
Iftikar
Pankaj PandeyPosted Jul 17, 2013, 2:27 AM
select BOOKING_NO from TEST_bookingno where REQUEST_DT=to_date('" + RequestDate + "','dd/MON/yy') with no lock.