I want to dispaly column in datagrid view using custom query statement but i want to send value to parametrized data in query how can i do this ? my code is below
select
c.customer_id,
c.customer_first_name,
c.customer_last_name,
c.customer_address,
c.account_number,
c.account_type,
a.account_balance,
t.transfer_amount_balance,
t.samebank_transfer_id,
t.account_number_same_bank,
t.transferdatetime
FROM customer_details c join account_details a on c.account_number = a.account_number
join transactions_details t on a.account_number = t.account_number where
c.customer_id = 'cus0010' and a.account_number = 'acc0010'
this above code working properly in sql server 2005but the code below which is modified as per asp.net page for grid view is not showing any resultselect c.customer_id, c.customer_first_name, c.customer_last_name, c.customer_address, c.account_number, c.account_type, a.account_balance, t.transfer_amount_balance, t.samebank_transfer_id, t.account_number_same_bank, t.transferdatetime FROM customer_details c join account_details a on c.account_number = a.account_number join transactions_details t on a.account_number = t.account_number where c.customer_id = 'Label1.Text' and a.account_number = 'Label2.Text'the above is placed in my custom sql query section it is triggered by button click in my asp page or any other idea to display it will be welcomed
I want to dispaly column in datagrid view using custom query statement but i
Share
Use:
string.Format("c.customer_id = '{0}' and a.account_number = '{1}'", Label1.Text, Label2.Text);Consider this query:
string query = "insert into TestTable (Column1, Column2) values (@p1, @p2)";p1 & p2 are parameters, in order to set the value for the parameters you need to use:
When the wizard is generating the query you need to use place holders/parameters for customer_ID and account_number and set their values by using parameters.
Edit:
In order to make the wizard create a parameter to use in the query, add a ? in the filter column in the query builder wizard.