Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

datacolumn

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveP - 16 Sep 2007 20:51 GMT
im Trying to set a Datacolumn type for a new table

boolean is not working, What is the correct waty

//column.DataType = System.Type.GetType"System.Data.SqlTypes.SqlBoolean");

column.DataType = System.Type.GetType"System.Boolean"); //"System.Boolean");

tia

Dave
DaveP - 16 Sep 2007 21:17 GMT
the above is corrected....
but im haveing a problem creating a datacolumn for sqlmoney
examples plz

DaveP

> im Trying to set a Datacolumn type for a new table
>
[quoted text clipped - 8 lines]
>
> Dave
Husam Al-A''araj - 16 Sep 2007 21:34 GMT
hello,
check this sample

public DataTable MakeDataTable(){
   
   DataTable myTable;
   DataRow myNewRow;
   // Create a new DataTable.
   myTable = new DataTable("My Table");

   // Create DataColumn objects of data types.
   DataColumn colString = new DataColumn("StringCol");
   colString.DataType = System.Type.GetType("System.String");
   myTable.Columns.Add(colString);

   DataColumn colInt32 = new DataColumn("Int32Col");
   colInt32.DataType = System.Type.GetType("System.Int32");
   myTable.Columns.Add(colInt32);

   DataColumn colBoolean = new DataColumn("BooleanCol");
   colBoolean.DataType = System.Type.GetType("System.Boolean");
   myTable.Columns.Add(colBoolean);

   DataColumn colTimeSpan = new DataColumn("TimeSpanCol");
   colTimeSpan.DataType = System.Type.GetType("System.TimeSpan");
   myTable.Columns.Add(colTimeSpan);

   DataColumn colDateTime = new DataColumn("DateTimeCol");
   colDateTime.DataType = System.Type.GetType("System.DateTime");
   myTable.Columns.Add(colDateTime);

   DataColumn colDecimal = new DataColumn("DecimalCol");
   colDecimal.DataType = System.Type.GetType("System.Decimal");
   myTable.Columns.Add(colDecimal);

   // Populate one row with values.
   myNewRow = myTable.NewRow();

   myNewRow["StringCol"] = "Item Name";
   myNewRow["Int32Col"] = 2147483647;
   myNewRow["BooleanCol"] = true;
   myNewRow["TimeSpanCol"] = new TimeSpan(10,22,10,15,100);
   myNewRow["DateTimeCol"] = System.DateTime.Today;
   myNewRow["DecimalCol"] = 64.0021;
   myTable.Rows.Add(myNewRow);
   return myTable;  
}

Cheers !

Husam Al-A'araj
www.aaraj.net

> im Trying to set a Datacolumn type for a new table
>
[quoted text clipped - 7 lines]
>
> Dave
DaveP - 16 Sep 2007 22:21 GMT
thanks alot
Davep

> hello,
> check this sample
[quoted text clipped - 62 lines]
>>
>> Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.