Avatar of Salah a a a Al Jasem
Salah a a a Al Jasem
Flag for Kuwait 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.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
ASP.NETVisual Basic.NETSQL

Avatar of undefined
Last Comment
Salah a a a Al Jasem

8/22/2022 - Mon
SOLUTION
Nitin Sontakke

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Ryan Chong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Salah a a a Al Jasem

ASKER
could not find a solution
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck