Salah a a a Al Jasem
asked on
vb.net, web page, SQL holding the selected data in an accessible variable
The following code works, but I did not like because in order to get selected sql data I have to add a gridview control!!
Is there a way to get the returned data in a variable
<asp:SqlDataSource ID="sourcename" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>">
</asp:SqlDataSource>
<%
sourcename.SelectParameter s.Add("Cus tIdIs", Session("CustIdIs"))
sourcename.SelectCommand = "SELECT Col1, col2 FROM Table WHERE Col0= @CustIdIs "
%>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False " DataSourceID="sourcename">
<Columns>
<asp:BoundField DataField="Col1" HeaderText="Txt1" SortExpression="ttt" />
<asp:BoundField DataField="Col2" HeaderText="Txt2" SortExpression="ttt" />
</Columns>
</asp:GridView>
<%
Dim I
Dim str As String
For I = 1 To GridView1.Rows.Count - 1
str = GridView1.Rows(I).Cells(0) .Text
Response.Write(str & "<br>")
Next
Is there a way to get the returned data in a variable
<asp:SqlDataSource ID="sourcename" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>">
</asp:SqlDataSource>
<%
sourcename.SelectParameter
sourcename.SelectCommand = "SELECT Col1, col2 FROM Table WHERE Col0= @CustIdIs "
%>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
<Columns>
<asp:BoundField DataField="Col1" HeaderText="Txt1" SortExpression="ttt" />
<asp:BoundField DataField="Col2" HeaderText="Txt2" SortExpression="ttt" />
</Columns>
</asp:GridView>
<%
Dim I
Dim str As String
For I = 1 To GridView1.Rows.Count - 1
str = GridView1.Rows(I).Cells(0)
Response.Write(str & "<br>")
Next
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER