Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to save the connection string in a class library pro
Message
De
16/10/2007 10:59:24
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
16/10/2007 10:18:12
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01261098
Message ID:
01261251
Vues:
16
Bonnie,
Can you demonstrate how you would do so for a base textbox class, for example?

Thanks!

>Hi Sergio,
>
>To databind, simply add to the DataBinding collection of each control:
>
>
>this.txtOne.DataBindings.Add("Text", dsData.Tables[0], "MyFirstColumn");
>this.txtLast.DataBindings.Add("Text", dsData.Tables[0], "MyLastColumn");
>
>
>In our "Framework", I've created a DataBind() method in each of my controls. I recommend doing something like that in all your base control classes.
>
>~~Bonnie
>
>
>
>
>
>>Hello Bonnie,
>>
>>I have followed your advice about n-tier and I have the following question.
>>
>>I have a winform that calls a business class that return a dataset(dsData).
>>
>>How do I bind my textboxes on my form to this dataset???.
>
>>
>>Below is the code of my form
>>
>>
>>using System;
>>using System.Collections.Generic;
>>using System.ComponentModel;
>>using System.Data;
>>using System.Drawing;
>>using System.Text;
>>using System.Windows.Forms;
>>
>>using UPCI.WinUI;
>>using UPCI.Atlas.Business.MyBiz;
>>
>>namespace UPCI.Atlas.WinUI.MyUI
>>{
>>    public partial class Policy : UPCIForm
>>    {
>>        private string PolicyNumber;
>>        private DataSet dsData;
>>        private PolicyBiz oBiz;
>>
>>        // Need to save the polid so  later I can get related info
>>        public string PolID;
>>
>>        public Policy(string pn)
>>        {
>>
>>            this.PolicyNumber = pn;
>>            InitializeComponent();
>>
>>            this.FillData();
>>        }
>>        public void FillData()
>>        {
>>            // I'm directly calling a Biz class. In reality, a Web Service
>>            // should be here which calls the Biz class
>>            oBiz = new PolicyBiz();
>>            dsData = oBiz.GetPolicy(this.PolicyNumber);
>>
>>
>>
>>        }
>>
>>        private void Policy_Load(object sender, EventArgs e)
>>        {
>>
>>        }
>>
>>        private void Policy_Layout(object sender, LayoutEventArgs e)
>>        {
>>            //this.tabControl1.Dock = DockStyle.Fill;
>>        }
>>
>>
>>    }
>>}
>>
>>
>>
>>Thanks,
>>Sergio
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform