C# ode>ALTER PROCEDURE语句,以便保存更改?因为代码可以工作(我刚刚测试过)。嗯,你确定Request.QueryString[DropDownList1.SelectedValue.ToString()]不应该只是DropDownList1
C# ode>ALTER PROCEDURE语句,以便保存更改?因为代码可以工作(我刚刚测试过)。嗯,你确定Request.QueryString[DropDownList1.SelectedValue.ToString()]不应该只是DropDownList1,c#,sql,search,C#,Sql,Search,ode>ALTER PROCEDURE语句,以便保存更改?因为代码可以工作(我刚刚测试过)。嗯,你确定Request.QueryString[DropDownList1.SelectedValue.ToString()]不应该只是DropDownList1.SelectedValue.ToString()?(请参阅我的更新)好的,现在我在选择一封信时出现了一个错误。用户代码未处理HTTPException。错误发生在CustomerRepeater.DataBind()上,它表示System.D
ode>ALTER PROCEDURE语句,以便保存更改?因为代码可以工作(我刚刚测试过)。嗯,你确定
Request.QueryString[DropDownList1.SelectedValue.ToString()]
不应该只是DropDownList1.SelectedValue.ToString()
?(请参阅我的更新)好的,现在我在选择一封信时出现了一个错误。用户代码未处理HTTPException。错误发生在CustomerRepeater.DataBind()上,它表示System.Data.DataRowView不包含名为“CustomerID”的属性。什么?!为什么它返回CustomerID
SELECT *
FROM CUSTOMER
WHERE LEFT(NAME, 1) = 'A'
CREATE PROCEDURE [dbo].[procCustomer_SelectByFirstLetter]
@SearchTerm VARCHAR(50)
AS
SELECT [Name]
FROM [dbo].[Customer]
WHERE LEFT(NAME, 1) = '@SearchTerm'
GO
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable customerTable = Customer.SelectByFirstLetter(Request.QueryString[DropDownList1.SelectedValue.ToString()]);
CustomerRepeater.DataSource = customerTable;
CustomerRepeater.DataBind();
CustomerCountLabel.Text = customerTable.Rows.Count.ToString();
}
WHERE LEFT(NAME, 1) = @SearchTerm
WHERE NAME LIKE 'A%'
WHERE NAME LIKE @SearchTerm + '%'
DataTable customerTable = Customer.SelectByFirstLetter(Request.QueryString[DropDownList1.SelectedValue.ToString()]);
DataTable customerTable = Customer.SelectByFirstLetter(DropDownList1.SelectedValue.ToString());
LEFT(NAME, 1) = @SearchTerm
LEFT(NAME, 1) = '@SearchTerm'
CREATE PROCEDURE [dbo].[procCustomer_SelectByFirstLetter]
@SearchTerm VARCHAR(50)
AS
SELECT [Name]
FROM [dbo].[Customer]
WHERE LEFT(NAME, LEN(@SearchTerm)) = @SearchTerm
Customer.SelectByFirstLetter(Request.QueryString[DropDownList1.SelectedValue.ToString()]);
Customer.SelectByFirstLetter(DropDownList1.SelectedValue.ToString());
CREATE PROCEDURE [dbo].[procCustomer_SelectByFirstLetter]
@SearchTerm CHAR(1)
AS
SELECT
[Name]
FROM
[dbo].[Customer]
WHERE
LEFT(NAME, 1) = @SearchTerm
GO
CREATE PROCEDURE [dbo].[procCustomer_SelectByNameStart]
@SearchTerm VARCHAR(MAX) /*Use your column width here*/
AS
SELECT
[Name]
FROM
[dbo].[Customer] C
WHERE
C.[Name] LIKE @SearchTerm + '%'
GO
if (!Page.IsPostback)
{
}