我有一个java脚本变量,我想将它用作我的sqldatasource作为参数我该怎么做?这是我的java脚本代码。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<link href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://icsid.worldbank.org/Style%20Library/jquery.SPServices-0.7.2.min.js"> type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var **userName** = $().SPServices.SPGetCurrentUser({
fieldName: "Name",//Name includes Domain userName DOES NOT
debug: false
});
document.getElementById('UserID').innerHTML = userName;
});
</script>
<asp:Label runat="server" id="UserID"></asp:Label>
&#13;
我想在SQL查询中使用var username作为@Sales_Pro_Number参数。 WHERE(([Customer Name] = @Customer_Name)AND([Sales Pro Number] = @Sales_Pro_Number)AND([Warehouse Id] = @Warehouse_Id))。有没有办法存储var用户名并将其用作@Sales_Pro_Number参数? 以下不起作用。 我无法使用背后的代码
<asp:SqlDataSource id="SqlDataSourceDropdownC_Done" runat="server" __designer:commandsync="true" ProviderName="System.Data.SqlClient" ConnectionString=...
SelectCommand="SELECT [Cust_Done]
FROM [sportsCD_Data_TEST]
WHERE (([Customer Name] = @Customer_Name) AND
([Sales Pro Number] = @Sales_Pro_Number) AND
([Warehouse Id] = @Warehouse_Id))" ....>
<SelectParameters>
<asp:controlparameter ControlID="DropDownListCustomer" PropertyName="SelectedValue" Name="Customer_Name" Type="String" />
<asp:controlparameter ControlID="UserID" PropertyName="Text" Name="Sales_Pro_Number" Type="String" />
<asp:controlparameter ControlID="DropDownListLocation" PropertyName="SelectedValue" Name="Warehouse_Id" Type="String" />
</SelectParameters>
&#13;
或者有没有办法提取SP用户名并用作参数值?