Hi, I get the following error when the same user log in n
borrow more than 1 book at one time.
My LoanRecord tbl in database is like this:
Borrow_Date dateTime 8 (Primary Key)
User_id char 10
Title_id char 10
Title varchar 150
Due_Date dateTime 8
Status char 1
Server Error in '/e-library' Application.
--------------------------------------------------------------------------------
Violation of PRIMARY KEY constraint 'PK_LoanRecord'. Cannot insert duplicate key in object 'LoanRecord'. The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_LoanRecord'. Cannot insert duplicate key in object 'LoanRecord'. The statement has been terminated.
Source Error:
Line 224: SqlDataAdapter1.InsertCommand.Parameters("@Status" ).Value = "N"
Line 225: 'SqlConnection1.Open()
Line 226: SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
Line 227: SqlConnection1.Close()
Line 228: End Sub
Source File: c:\inetpub\wwwroot\e-library\Borrow.aspx.
vb Line: 226
Stack Trace:
[SqlException: Violation of PRIMARY KEY constraint 'PK_LoanRecord'. Cannot insert duplicate key in object 'LoanRecord'.
The statement has been terminated.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
e_library.Borrow.Loan(String Title_id, String Title) in c:\inetpub\wwwroot\e-library\Borrow.aspx.
vb:226
e_library.Borrow.DataGrid1_ItemCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\e-library\Borrow.aspx.
vb:147
System.Web.UI.WebControls.DataGrid.OnItemCommand(D ataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
[code]
Thanks in advance for any help!
Irene