Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Database tables: Pay and Nproject and Member.
The Pay and Member, Dsc field is common.
I have two forms, in each form is a table Nproject ComboBox Dsc field when you click the OK button to load the data into the table on gridview is displayed.

But now when I run the program and choose the ComboBox and click OK button gridview does not display anything.Just Two Dsc show in gridview.

I Use sql serever 2008 for database. In Member table Dsc field Type is nvarchar(254). when run a program just display two Dsc(بدون پروژه - گلمان) in dbgrid and other Dsc don't display in dbgrid.

-----


Proge.text is combobox in two forms

پروژه 144 واحدی ** Don't show this dsc in dbrid
پروژه 156 واحدی ** Don't show this dsc in dbrid
پروژه 240 واحدي ** Don't show this dsc in dbrid
بدون پروژه
گلمان

----------------

CodeSource Ds = new CodeSource();
Grd.DataSource = Ds.LoadGrids("Select * From Members where Dsc = '" + Proge.Text + "' ");

----------

code in my class Name's : CodeSource

public BindingSource LoadGrids(string SqlStatement)
{
SqlDataAdapter sda = new SqlDataAdapter(SqlStatement, connectionString);
DataTable dTable = new DataTable();
sda.Fill(dTable);
BindingSource bSource = new BindingSource();
bSource.DataSource = dTable;
sda.Dispose();
dTable.Dispose();
return bSource;
C#


--------------
Posted
Comments
Mohammad Reza Valadkhani 17-Feb-15 7:19am    
first of all try to put your code into code block! it`s really better to read your code, another thing try to fetch your query result and see if result is exactly the same as what is shown in your grid-view ?!

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