我的代码隐藏中有所有表单变量,它们都是使用“Request.Form”检索的。
据我所知..如果我使用 SQLDataSource 来执行此操作,我必须使用 ASP.NET Controlls(我不想要)。
INSERT INTO Orders(FirstName, LastName, Email, PhoneNumber, Address, City, State, ZipCode, PaymentMethod, PromoCode, OrderStatus, Tracking, PPEmail, SubmissionDate) VALUES (@FirstName, @LastName, @Email, @Phone, @Address, @City, @State, 11111, @PaymentMethod', '0', 'New Order - Pending', '0', @PPEMAIL, @Date)
代码隐藏
Dim fPrice As String = CType(Session.Item("Qprice"), String)
Dim DeviceMake As String = CType(Session.Item("Make"), String)
Dim PaymentMethod As String = Request.Form("Payment Type")
Dim DeviceModel As String = CType(Session.Item("Model"), String)
Dim DeviceCondition As String = CType(Session.Item("Condition"), String)
Dim SubmissionDate As String = Date.Now.ToString
Dim FirstName = Request.Form("First")
Dim LastName = Request.Form("Last")
Dim City = Request.Form("City")
Dim Phone = Request.Form("Phone")
Dim Address = Request.Form("Address")
Dim State = Request.Form("State")
Dim Zip = Request.Form("Zip")
Dim Email = Request.Form("EMail")
有没有一种方法可以将我的变量附加到 SQLDatasource 生成的插入语句,而无需手动编码参数?