protected void btnInsert_Click(object sender, EventArgs e)
{
string custName = ddlCustomerName.SelectedValue;
string listing = ddlListing.SelectedValue;
sdsCustomers.InsertParameters["@CustomerID"].DefaultValue = sdsCustomerName.SelectParameters["CustomerID"].DefaultValue;
sdsCustomers.InsertParameters["ListingID"].DefaultValue = sdsCustomerName.SelectParameters[listing].DefaultValue;
sdsCustomers.InsertParameters["FullName"].DefaultValue = custName;
sdsCustomers.InsertParameters["Date"].DefaultValue = txtBxDate.ToString();
sdsCustomers.InsertParameters["Reason"].DefaultValue = ddlReason.SelectedValue;
sdsCustomers.InsertParameters["BidPrice"].DefaultValue = txtBxBidPrice.Text;
sdsCustomers.InsertParameters["CommissionRate"].DefaultValue = txtBxDate.Text;
sdsCustomers.Insert();
}
你能告诉我我在这里做错了什么吗?
SELECT
CustAgentList.AgentID, CustAgentList.CustomerID,
Customers.LastName + ', ' + Customers.FirstName AS FullName,
CAST(CustAgentList.ListingID AS VARCHAR) + ', ' + Customers.Address + ', ' + Customers.City AS Listing,
CustAgentList.ContactDate AS Date, CustAgentList.BidPrice,
CustAgentList.CommissionRate, ContactReason.ContactReason AS Reason
FROM
CustAgentList
INNER JOIN
Customers ON CustAgentList.CustomerID = Customers.CustomerID
INNER JOIN
ContactReason ON CustAgentList.ContactReason = ContactReason.ContactReason
WHERE
(CustAgentList.AgentID = @AgentID)
ORDER BY
Date
这是我的sdsCustomer insertCommand
。使用它的 datagridviewSqlDataSource
填充得很好。