Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

John Gathogo

@John Gathogo
About
Posts
107
Topics
38
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Replace assembly at runtime
    J John Gathogo

    One way would be to load the assemblies using Reflection. That way, if an assembly changes periodically, you will get the latest

    C# csharp question announcement

  • Getting InvalidCastException using VS2005 TableAdapter generator to call a stored procedure
    J John Gathogo

    The return type for CountUniqueBirthdays may not be long (or long? for that matter). Have you tried [int]? Or just receive it into an [object] variable and use Watch to see what it contains? i.e.

    object value = adapter.CountUniqueBirthdays(leadID);

    Database database question workspace

  • Retrieve Value from TextBox Which is created in the code behind
    J John Gathogo

    You add the textbox using Controls.Add(). When creating the textbox from codebehind, you can assign it an ID say, tbDynamicId.

    TextBox tb = new TextBox();
    tb.ID = "tbDynamicId";
    this.Controls.Add(tb); //To add the the current form

    Then you can get the textbox like:

    TextBox tbDynamic = (TextBox)FindControl("tbDynamicId");

    And then retrive the value normally,

    String value = tbDynamic.Text;

    C# help

  • Reading PDF data from Byte Stream
    J John Gathogo

    You can convert a byte array to a string using: System.Text.Encoding.Unicode.GetString([byteArray]); Note: Unicode is just one of the encodings. You can use ASCII, UTF8, etc

    C# csharp mcp data-structures performance help

  • Unable to Use Net TCp Binding
    J John Gathogo

    Could it be because you are missing the mexHttpBinding? <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>

    WCF and WF wcf csharp wpf security help

  • parameter with the In function
    J John Gathogo

    I guess your parameter might be comprising of a delimited string, say, "1,2,4,8" or even "{Guid1},{Guid2},...". If such is your requirement, you can always use some little tweaks. Like Declare a temporary table to store the Ids, like declare @Ids table(Id int) Then, use some string functions to split the string and insert the ids into the table. (Like, CHARINDEX, SUBSTRING, etc) After that, you can then use the temporary table on your WHERE ... IN ... clause Like select * from tbl_Name where id in (select Id from @Ids)

    Database database tutorial question

  • Primary Key in SQL Server Table Variable
    J John Gathogo

    Is there any benefit in setting a primary key in a table variable? Especially if you will perform SELECT and INSERT operations on it? Like, DECLARE @Tbl TABLE(Id INT PRIMARY KEY, Name NVARCHAR(36))

    Database database sql-server sysadmin question

  • ROW_NUMBER Conversion
    J John Gathogo

    Hi Guys, Am trying to LINQ the following statement: Please, if you can help out, please do.

    SELECT
    ROW_NUMBER() OVER (ORDER BY LastName, FirstName) AS RowNumber,
    *
    FROM
    dbo.Customers
    ORDER BY
    CustomerID

    LINQ csharp linq help

  • Compiled LINQ Queries
    J John Gathogo

    Lets start here. I have the following two classes:

    public class Order
    {
        public Int32 Id { get; set; }
        public String OrderNumber { get; set; }
        public DateTime OrderDate { get; set; }
        public String OrderStatus { get; set; }
        public Int32 CustomerId { get; set; }
        public List<OrderItem> Items { get; set; }
        public Decimal Total { get; set; }
    }
    
    public class OrderItem
    {
        public Int32 OrderId { get; set; }
        public Int32 OrderLineNumber { get; set; }
        public Int32 ItemId { get; set; }
        public Double OrderQty { get; set; }
        public Decimal Price { get; set; }
        public Decimal LineTotal { get; set; }
    }
    

    Here is some LINQ query that am using to fetch Orders from two database tables (OrderMaster and OrderDetail) and return a List<Order>. The LINQ DataContext that has the two tables is named TempContext.

        static List<Order> GetOrders()
        {
            using (var context = new TempContext())
            {
                return (from om in context.OrderMasters
                        select new Order
                        {
                            Id = om.OrderID,
                            OrderNumber = om.OrderNumber,
                            OrderDate = om.OrderDate,
                            OrderStatus = om.OrderStatus,
                            CustomerId = om.CustomerID,
                            Total = om.Total,
                            Items = (from od in context.OrderDetails.Where(d => d.OrderID == om.OrderID)
                                     select new OrderItem
                                     {
                                         OrderLineNumber = od.OrderLineNumber,
                                         OrderId = od.OrderID,
                                         ItemId = od.ItemID,
                                         OrderQty = od.OrderQty,
                                         Price = od.Price,
                                         LineTotal = od.Total
                                     }).ToList()
                        }).ToList();
            }
        }
    

    My idea is to convert this LINQ Query to a Compiled LINQ Query and see whether I will be able to get any notable improvements on execution performance. Here is what I was able to

    ASP.NET database csharp linq performance

  • Use variable from the code behind
    J John Gathogo

    What about

    InsertCommand="INSERT INTO table (column1, column2) VALUES (value1, '" + UserID + "')"

    Assuming that you are doing this from within RadGrid1_PreRender routine.

    ASP.NET question

  • web.config file related issue
    J John Gathogo

    I see that you are using InProc to store state. The following will suffice in this case: <sessionState mode="Inproc" cookieless="false" timeout="20"/> You do not need the tcpip attribute

    ASP.NET question help

  • Interface member's attributes
    J John Gathogo

    Sorry for the misunderstanding Mr. Candyman. Am not exactly sure whether you have to still implement the attribute too.

    C# oop tutorial question

  • Interface member's attributes
    J John Gathogo

    You will also need to implement the properties when implementing the interfaces like:

        protected string m\_PropertyName;
    
        public string PropertyName
        {
            get
            {
                return m\_PropertyName;
            }
            internal set
            {
                m\_PropertyName = value;
            }
        }
    

    So, it is expected that you will implement the get and set in derived classes

    C# oop tutorial question

  • to get all services in the machine
    J John Gathogo

    Depending on what you mean by "get", Typing "net start" on your command prompt will list for you the services running on your computer. For programmatic access you can use ServiceController class after importing the corresponding namespace.

    C# question

  • System.Convert.ToDouble(stringVal)
    J John Gathogo

    No difference actually. System is almost always automatically added in "using" section.

    C#

  • check box in grid view
    J John Gathogo

    You most probably, you should create an event that updates the datasource for the GridView (particularly the field that is updated with the checkmark value) when you check mark your checkbox. Otherwise, it is not like the other pages exist. They are generated as you move from one page to the next - on demand.

    ASP.NET css

  • web.config file related issue
    J John Gathogo

    The thing is, for a typical application, you dont need to bother with this tcpip. Just let it be. Unless you are sure that based on what you are doing, this tcpip value needs to be changed. You could perhaps give some details.

    ASP.NET question help

  • need to Develope web app..?
    J John Gathogo

    Search for resources on web application development here

    ASP.NET question csharp winforms

  • First web service on ASP.Net
    J John Gathogo

    Just right-click on the project (Web Application) from Solution Explorer, click on Add Web Reference. You will get a dialog box. Under a label: [Browse to:] click [Web services in this solution]. VS will discover all the web services in your solution and they will be presented in a list. Click on the one you want to use and, after giving it an appropriate web reference name add it (VS might suggest something like 'localhost'). You will then be ready to go. You can add the sample code on the Page_Load of a web form in your web application.

    ASP.NET help csharp asp-net wcf com

  • First web service on ASP.Net
    J John Gathogo

    I had a look at the link you quoted. The console application is the client. It should work. Make sure that your console project is the start up project. Right click on the project from Solution Explorer and click "Set as Startup Project".

    ASP.NET help csharp asp-net wcf com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups