Click here to Skip to main content
15,924,367 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i add 2 column code and place in gridview

C#
string s = "select Code , Place from table"
sCommand = new SqlCommand(s, con);
sdAdapter = new SqlDataAdapter();
sdAdapter.SelectCommand = sCommand;
dt = new DataTable();
sdAdapter.Fill(dt);
BindingSource BSource = new BindingSource();
BSource.DataSource = dt;
dataGridView1.DataSource = BSource;


What I have tried:

how i pass every column to columns in table
Posted
Updated 22-Jun-16 2:08am
v2
Comments
[no name] 22-Jun-16 8:07am    
Your question is not clear can you explian in detail?
MahmoudOmar 22-Jun-16 8:11am    
i create gridview in form and i add columns from this grid.

i want pass select query with this columns that i created in this grid how i do that ?
[no name] 22-Jun-16 8:17am    
set the column property DataField with the column name of database which you want to bind it.
MahmoudOmar 22-Jun-16 8:32am    
please i need videos or link for help and thanks

1 solution

C#
string s = "select Code , Place from table"


assuming table has more columns and you want them all, you could go

C#
string s = "select * from table"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900