troubleshooting Question

vb.net, web page, SQL holding the selected data in an accessible variable

Avatar of Salah a a a Al Jasem
Salah a a a Al JasemFlag for Kuwait asked on
ASP.NETVisual Basic.NETSQL
7 Comments6 Solutions167 ViewsLast Modified:
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.SelectParameters.Add("CustIdIs", 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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 6 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros