473,507 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datacolumn

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.SqlBoolea n");

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

tia

Dave


Sep 16 '07 #1
3 6186
the above is corrected....
but im haveing a problem creating a datacolumn for sqlmoney
examples plz

DaveP

"DaveP" <dv*****@sbcglobal.netwrote in message
news:aP****************@newssvr14.news.prodigy.net ...
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.SqlBoolea n");

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

tia

Dave


Sep 16 '07 #2
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
"DaveP" wrote:
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.SqlBoolea n");

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

tia

Dave


Sep 16 '07 #3
thanks alot
Davep

"Husam Al-A''araj" <Hu**********@discussions.microsoft.comwrote in message
news:BE**********************************@microsof t.com...
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
"DaveP" wrote:
>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.SqlBoole an");

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

tia

Dave



Sep 16 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
18653
by: J | last post by:
Is there anyway to format a calculated datacolumn? I would like the following column to display as money (formatted as $#,##0.00). Or how about simply displaying the column formatted as a number...
1
5388
by: Chris | last post by:
I'm having trouble Serializing a System.Data.DataColumn object. When I try to serialize it, I get the following: System.NotSupportedException: Cannot serialize member...
5
8058
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
4
2443
by: bordsby | last post by:
Situation: I am using an OleDbDataAdapter to fill a DataSet's DataTable with data from an Access database. The DataSet's DataTable is bound to a DataGrid. After the OleDbDataAdapter.Fill method...
1
13915
by: Jay Balapa | last post by:
Hello, Iam trying to do the following- if(myColumn.DataType==typeof(bool)) { } this does not work either Type.GetType("System.Boolean") instead of typeof(bool).
1
7822
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
11
21838
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on...
0
925
by: SWIL | last post by:
Hi, I made my own datacolumn Class which inherits from Data.DataColumn. To this class I have added 2 properties. To add datacolumn created through my new class I have to call.. ...
0
4512
by: SMH | last post by:
Hi All, I am currently learning .Net 2, studying for 70-528. I've hit a bit of a brick wall with DataColumn.Expression. As I understand it, this can be used to (For example) concatenate two...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.