Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9215161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:08:33+00:00 2026-06-18T02:08:33+00:00

I have the following gridView select command – SelectCommand=SELECT [columnA] FROM [DB].[dbo].[TABLE] WHERE value

  • 0

I have the following gridView select command –

SelectCommand="SELECT [columnA] FROM [DB].[dbo].[TABLE] WHERE value = 1

When running it brings back the desired result into the gridview, however I am passing a string value from the previous page to populate a textBox and on page load want the gridview SelectCommand to be determined by that string.

So something like –

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

SelectCommand="SELECT [columnA] FROM [DB].[dbo].[TABLE] WHERE value = <%TextBox1.Text%>

However this is not picking up the string value on page load.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:08:34+00:00Added an answer on June 18, 2026 at 2:08 am

    This kind of query is prone to SQL Injection, You can use parameters instead. And Use the value you get from your QueryString.

    SqlCommand comm = new SqlCommand();
    comm.CommandText = "SELECT [columnA] FROM [DB].[dbo].[TABLE] WHERE value = @value";
    comm.Parameters.AddWithValue("value", Request.QueryString["string"]);    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview in an update panel with the following code to select
How can I select all data from GridView s current row.. I have a
I have the following aspx: <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False BorderStyle=None Font-Names=Verdana Font-Size=12px OnSelectedIndexChanged=GridView1_SelectedIndexChanged ShowHeader=False
I have a gridview with couple of columns,I want to achieve the following: If
I have the following sql query that I want to display in a gridview,
Suppose I have following table in my database: Tbl_Persons: Id Country Name 1 Australia
I have the following two controls in my code gridview (for data display) sqldatasource
I have the following GridView and ObjectDataSource: <asp:GridView ID=grdTrades runat=server DataSourceID=srcTrades DataKeyNames=tradeId EnablePersistedSelection=true SelectedRowStyle-BackColor=Yellow
In my GridView, I have the following columns: <Columns> <asp:BoundField DataField=report_type HeaderText=Report Type SortExpression=report_type
I have a gridview with following fields LECTURE ID,LECTURER NAME,SUBJECTS and gridview contains link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.