Rockford .Net User Group

The premier .Net User Group in the Northern Illinois Area
Welcome to Rockford .Net User Group Sign in | Join | Help

back with a new alias

  •  01-01-2008, 10:10 PM

    back with a new alias

    I ran into a snag with my password; I forgot a typographical character was required. So, I started a new identity; you might notice my e-mail address changed too. Anyway, I decided to give SQL Server 3.5 a try. Here is a couple of entities I created with C# 2008 Express. I know it looks sloppy, but it works.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data.Linq.Mapping;

    namespace BudgetCalc_CS_DS1
    {
        [Table(Name="DetailTable")]
        class DetailTable
        {
            [Column(DbType = "nvarchar(100)")]
            public string BudgetID;
            [Column(DbType = "nvarchar(100)")]
            public string ItemName;
            [Column]
            public int ItemPercent;
            [Column(DbType = "money")]
            public decimal ItemAmount;
            [Column(DbType = "nvarchar(100)", IsPrimaryKey = true)]
            public string ItemKey;
        }
    }

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data.Linq.Mapping;

    namespace BudgetCalc_CS_DS1
    {
        [Table(Name="HeaderTable")]
        class HeaderTable
        {
            [Column(IsPrimaryKey = true)]
            public string BudgetID;
            [Column(DbType="money")]
            public decimal BudgetAmount;
        }
    }

    I also created a class that inherits DataContext and contains two Table members, each associated with a different entity class. I also wrote some simple LINQ code that uses the classes I just mentioned. E-mail me at pelayorex@insightbb.com if you want me to post examples. Lastly, I've been given the task of writing a chatroom system for a friend of a friend, and I plan to use LINQ-to-SQL (or possibly LINQ-to-XML if the host can't handle SQL Server 3.5) there too.

    Ross

     

    Filed under: , ,
View Complete Thread
Powered by Community Server, by Telligent Systems