1
有一个在我的数据库中的问题,当我执行此:SQL Server不能执行
<asp:SqlDataSource ID="SqlDataSourceCombine" runat="server"
ConnectionString="<%$ ConnectionStrings:DefaultConnection %>"
DeleteCommand="DELETE FROM [Product] WHERE [ProductId] = @ProductId"
InsertCommand="INSERT INTO [Product] ([ProductName], [ProductDescription], [ProductCategory], [ProductBrand], [ProductPrice], [ProductQty], [ProductUploadDate]) VALUES (@ProductName, @ProductDescription, @ProductCategory, @ProductBrand, @ProductPrice, @ProductQty, @ProductUploadDate)"
SelectCommand="SELECT Product.*, ProductCategory.*, ProductBrand.*
FROM Product
INNER JOIN ProductCategory AS PC ON Product.ProductCategory = ProductCategory.CategoryId
INNER JOIN ProductBrand AS PB ON Product.ProductBrand = ProductBrand.BrandId"
UpdateCommand="UPDATE [Product] SET [ProductName] = @ProductName,
[ProductDescription] = @ProductDescription,
[ProductCategory] = @ProductCategory,
[ProductBrand] = @ProductBrand,
[ProductPrice] = @ProductPrice,
[ProductQty] = @ProductQty,
WHERE [ProductId] = @ProductId">
</asp:SqlDataSource>
我得到这个错误:
在'的ConnectionStrings:DefaultConnection',你有'初始Catalog'集?如果是这样,是否设置为'[Product]'表所在的相同数据库? 'dbo'模式中的'[Product]'表? – tarheel