Hi, I need help with gridview?

actually the gridview is supposed to show a view(aka join) consisting of two tables .

In my case I have (userid) , (money depositted) fields in table 1; userid can also be left as null.


I have another table I have first_name, last_name,phone numbers( fields) in table2

I want to display first_ name ,money depositted.
in the gridview.

It has to show all the enteries made in table 1 either it is null or has some userid; if it becomes null , then a space should appear instead of displaying null.


can anyone please guide me how to do this?

thanks

perhaps create a stored procedure that will select the data after the join?...im a newb, so i apologize if this is wrong

With sql server you can use query like this.

select t1.first_ name ,t2.money depositted from table1 t1 left join table2 t2 on t1.userid=t2.userid

left join should help for null values. If you like to hide null values you should use instead inner join.

C# can not create update statement by it self for joined queries 2.0 at least.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.