问题描述
我正在处理的网站是一个租车项目。
在我的主页上我有一个表格,用户可以选择接送日期,接送地点,退货日期,和汽车类型。
现在这4个信息是我在用户按下(预订)按钮时存储为cookie的输入值。
用户按下后(在主页中按下该按钮,表单将被提交,并在另一个页面中重定向,其中根据前一个表单的值向用户显示汽车列表。
点击汽车时你喜欢你去一个新的页面,你有汽车的详细信息,我也检索存储为cookie的表格的值,并显示它们,以防他想要更改它们。
所以在这个页面上有汽车详细信息,用户可以按下提交按钮预订汽车。
我尝试了什么:
现在在sql server中我有2个表(Products)和(RentInfo)。产品是我在管理面板中创建的产品,我也在页面中显示它们,(RentInfo)是我想在用户按下(预订)按钮后存储表单值和汽车详细信息的表格。汽车详细信息页面。
现在的问题是我如何在(RentInfo)表中保存表格值和汽车详细信息而不重复汽车细节,因为我已将它们放在(产品)中表。每次我想在管理面板中显示(RentInfo)表时,如何从那里检索它们?
我在VISUAL STUDIO ASP.NET中使用RAZOR WEB PAGES
如果它太难理解我的问题,请告诉我。
The site i am working on is a car rent project.
In my home page i have a form where the user can select Date of pick up , place of pick up , date of return , and the car type.
Now this 4 informations are input values that i store as cookies when the user presses the (book it) button.
After the user presses the (book it) button in the home page the form is submited and it redirects in another page where a list of cars is shown to the user according to the values of the previous form.
When click on a car you like you go to a new page where you have the car details and also i retrieve the values of the form that were stored as cookies and i display them in case he wants to change them.
So in this page with the car details the user can press the submit button to book the car.
What I have tried:
Now in the sql server i have 2 tables (Products) and (RentInfo). Products are the products that i create in the admin panel and i also display them in the pages and (RentInfo) is the table where i want to store the form values and the car details after the users presses the (book it) button in the car details page.
Now the problem is how can i save the form values and the car details in the the (RentInfo) table without duplicating the car details, since i have them already in the (Products) table. How can i retrieve them from there everytime i want to display the (RentInfo) table in my admin panel?
I WORK ON RAZOR WEB PAGES IN VISUAL STUDIO ASP.NET
If its too hard to understand my question please let me know.
推荐答案
SELECT *
FROM RentInfo
INNER JOIN Products ON RentInfo.ProductID = Products.ProductID
以下是一些您可能会觉得有用的特定链接
[]
[]
[]
[]
或者如果您喜欢书籍,请尝试 []
最后,上有大量数据库设计示例[ ]
Here are some specific links that you might find useful
Relational Database Design with an Auto Insurance Database Sample[^]
Visual Representation of SQL Joins[^]
SQL Server Tutorial[^]
MS SQL Server Tutorial[^]
Or if you prefer books try Beginning Database Design - From Novice to Professional | Clare Churcher | Apress[^]
Finally, there are loads of examples of Database design at http://www.databaseanswers.org/data_models/[^]
这篇关于如何将两个SQL表信息绑定在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!