|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can I do this on One line of code?Seems silly I need two lines of code for this. Any way to do it in one?
Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} MyData.Tables(0).PrimaryKey = DcArray "gregory_may" <None> schrieb mydata.Tables(0).PrimaryKey = New DataColumn()> Seems silly I need two lines of code for this. Any way to do it in one? > > > > Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} > > MyData.Tables(0).PrimaryKey = DcArray {mydata.Tables(0).Columns("PhoneNumber")} Two lines only due to word wrapping in the posting. :) Usually I would write mydata.Tables(0).PrimaryKey = New DataColumn() { _ mydata.Tables(0).Columns("PhoneNumber") _ } but than you had three lines instead of one.... Therefore I would change it to Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} MyData.Tables(0).PrimaryKey = DcArray Ooops, that's what you already have. ;-) Armin Gregory,
> Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} Cor> > MyData.Tables(0).PrimaryKey = DcArray > No "gregory_may" <None> wrote in message Haven't tried it, but does this work?news:O8ZkIqIHGHA.240@TK2MSFTNGP11.phx.gbl... > Seems silly I need two lines of code for this. > Dim DcArray() As > DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} > MyData.Tables(0).PrimaryKey = DcArray > Any way to do it in one? With MyData.Tables(0) .PrimaryKey _ = New DataColumn() { .Columns("PhoneNumber") } End With HTH, Phill W. MyData.Tables(0).PrimaryKey = New DataColumn()
{MyData.Tables(0).Columns("PhoneNumber")} Show quoteHide quote "gregory_may" <None> wrote in message news:O8ZkIqIHGHA.240@TK2MSFTNGP11.phx.gbl... > Seems silly I need two lines of code for this. Any way to do it in one? > > > > Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} > > MyData.Tables(0).PrimaryKey = DcArray > > > Thanks guys, the New DataColumn() {} syntax is what I was after.
Thanks! Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%23tCOjCOHGHA.140@TK2MSFTNGP12.phx.gbl... > MyData.Tables(0).PrimaryKey = New DataColumn() > {MyData.Tables(0).Columns("PhoneNumber")} > > > "gregory_may" <None> wrote in message > news:O8ZkIqIHGHA.240@TK2MSFTNGP11.phx.gbl... >> Seems silly I need two lines of code for this. Any way to do it in one? >> >> >> >> Dim DcArray() As DataColumn = {MyData.Tables(0).Columns("PhoneNumber")} >> >> MyData.Tables(0).PrimaryKey = DcArray >> >> >> > >
Typed DataSet
create user and add to admin group under local system Run code under diffrent user Calling Java class from VB.net How to know if Windows Update is ON or OFF? Cpmute values in Dataset Table?? Collections Woes - Help! DataGridBoolColumn - Greyed Out vb.net asp converting Trick to getting System.Web.Mail to work? |
|||||||||||||||||||||||