Results 1 to 3 of 3

Thread: [RESOLVED] [2.0] Datacolum type

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Resolved [RESOLVED] [2.0] Datacolum type

    Hi all
    I am getting some problem for changing the type of the data column.
    Just check the code it is not working for me.


    C# Code:
    1. DataColumn dataColumn=new DataColumn();
    2. dataColumn.DataType = GetType[String];

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Datacolum type

    This could never work:
    Code:
    dataColumn.DataType = GetType[String];
    Square brackets are used to index arrays and collections. Is GetType an array or collection? No it isn't. Nor is GetType a statement in C#. In VB it would be:
    vb.net Code:
    1. dataColumn.DataType = GetType(String)
    In C# it's:
    C# Code:
    1. dataColumn.DataType = typeOf(String);
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: [2.0] Datacolum type

    Thanks sir

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width