لدي مشكلة في تطبيق أعمل عليه حالياً وهي أنني في أحد ال functions قمت بوضع جملتي update ..أما الأولى فتنفذ بدون مشاكل ،، لكن الثانية لا تعدل شيئا على الجدول المطلوب
هل ا لمشكلة في ان هناك حقل في كل من الجدولين بنفس الاسم (id) ؟؟؟؟
هذا هو الكود
Public Function reserve_car(ByVal w As Integer, ByVal x As Integer, ByVal y As String, ByVal z As String)
Dim connectionstring As String = WebConfigurationManager.ConnectionStrings("constr").ConnectionString
Dim updatesql As String
updatesql = "update customer set car_id=@car_id,start_date=@start_date,end_date=@end_date where id=@id"
Dim con As New SqlConnection(connectionstring)
Dim cmd As New SqlCommand(updatesql, con)
cmd.Parameters.AddWithValue("@id", x)
cmd.Parameters.AddWithValue("@car_id", w)
cmd.Parameters.AddWithValue("@start_date", y)
cmd.Parameters.AddWithValue("@end_date", z)
Dim updated As Integer = 0
Try
con.Open()
updated = cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox("error..." & ex.Message)
con.Close()
End Try
'these lines changes the state of the car to :"reserved"
Dim updatesql2 As String
updatesql2 = "update cars set state='" & "reserved" & "' where id=@cid"
Dim con2 As New SqlConnection(connectionstring)
Dim cmd2 As New SqlCommand(updatesql2, con2)
cmd2.Parameters.AddWithValue("@cid", w)
Dim updated2 As Integer = 0
Try
con2.Open()
updated2 = cmd.ExecuteNonQuery()
MsgBox("The car has been reserved successfully")
Catch ex As Exception
MsgBox("error..." & ex.Message)
con2.Close()
End Try
End Functionأعلم أني قد أثقلت عليكم بأسئلتي لكني جديد في مجال ال asp.net
بارك الله فيكم وجزاكم خيراً على المجهود الرائع ،، في موازين حسناتكم بإذن الله