2
Answers

C# - Custom DataSet within the form

ozzy

ozzy

14y
3.1k
1
Hi,
A newbie needs some help. I have a custom SQL connection and what I wanna do is, I wanna create a DataSet using this SQL connection. And I wanna be able to call this dataset from any method within the form. Just to be clear let's say :
I have gridcontrol named gridcontrol1, a button called button1. When I click to the button it should bind that dataset to the gridcontrol.
So I want to be able to call this dataset with different events.
I don't know how to make that dataset be able to called from anywhere in the form. Where should I put my codes for my dataset and in what (in a method, a new class or somewhere else?)

Thanks in advance.

EDIT :
I knew it. It's so easy. But as I said I'm a newbie. So here is my solution :
I defined my connection, dataset etc. like :

public static SqlConnection conn;
public static DataSet ds;
....

So I solved my problem...
Answers (2)