Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetAllData() for custom domain-table
Message
From
08/12/2008 11:13:51
León Carpay
Carpay Automatisering
Netherlands
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
GetAllData() for custom domain-table
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01365978
Message ID:
01365978
Views:
71
Hi, I'm looking for a way to retireve a subset from a sql-table. I have several key-value fields in the application which I store in one table. When I want to use the DataGridView in combination with a ComboBox I have to bind the ComboBox with a DataTable. MM doesn't support an overload for the GetAllData() method. I designed the (test) method below in the DomainRef class to populate the comboboxes. It works but I think there has to be better ways...
        public DataTable GetAllData2(int DomainID)
        {
            string cnStr;

            cnStr = mmAppBase.DatabaseMgr.GetConnectionString("BinaDB");
            using (SqlConnection cn = new SqlConnection(cnStr))
            {
                SqlCommand cmd = new SqlCommand("SELECT * FROM DomainRef WHERE DomainID = "  + DomainID.ToString() , cn);
                SqlDataAdapter adpt = new SqlDataAdapter(cmd);
                DataTable dtStuff = new DataTable("stuff");
                adpt.Fill(dtStuff);
                return dtStuff;
            }
        }
gr leon
Next
Reply
Map
View

Click here to load this message in the networking platform