Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# - Add and Update Records
Message
 
To
10/04/2008 11:05:15
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01309187
Message ID:
01309712
Views:
39
Yes, I agree. Right now I'm gathering ideas & prototyping. When I start development I will create BO and Data Layers,
and all this will return from there.

Thanks





>Hi Kevin,
>I think the only thing I would clarify is if you have a Biz Obj layer you probably want to return the dataset from there. Your sample doesn't really indicate either way so thought I would throw this in.
>
>You would still need a reference to the typed dataset in your UI since it is specific however
>
>So you would define it here but get it returned from the business layer.
>AppUserBizObj oAppUser = new AppUserBizObj;
>AppUserDataSet dsAppUser = oAppUser.GetUserDataSetById(-1); // Returns a typed dataset
>
>Tim
>
>>Ok folks, here's a snippet of what I've come up with. DSAppUser is a typed dataset. Please feel free to set me straight on any of this:
>>
>>
>>namespace TypedDataSetTest
>>{
>>    class MyTest
>>    {
>>        static void Main(string[] args)
>>        {
>>            // Reference to this class
>>            MyTest oThis = new MyTest();
>>
>>            // Instance of the typed dataset
>>            DSAppUser oDSUser = null;
>>
>>            // New record
>>            oDSUser = oThis.GetAppUser(-1);
>>
>>            // Existing record
>>            oDSUser = oThis.GetAppUser(5);
>>
>>        }
>>
>>        public DSAppUser GetAppUser(int iUserKey)
>>        {
>>            // Instance of the typed dataset
>>            DSAppUser oDSUser = new DSAppUser();
>>
>>            // If no key was passed...
>>            if (iUserKey == -1)
>>            {
>>                // Add a new row
>>                oDSUser.Tables[0].Rows.Add();
>>            }
>>            else
>>            {
>>                // Connect to the DB & get the requested record
>>                SqlConnection oConnection = new SqlConnection(sConnString);
>>                SqlCommand oCommand = new SqlCommand("select * from AppUsers where UserKey = " + iUserKey.ToString(), oConnection);
>>                SqlDataAdapter oAdapter = new SqlDataAdapter(oCommand);
>>
>>                oAdapter.Fill(oDSUser, oDSUser.Tables[0].TableName);
>>            }
>>
>>            return oDSUser;
>>        }
>>    }
>>}
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform