|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do I create a stand alone Dataset by ADO.NET?Hi,All.
I have the code written below which runs on VB6 and ADO. And I want migrate this onto VB.NET 2003 and ADO.NET. Could anybody give me a sample? Dim Rs As New ADODB.RecordSet With Rs ?$B!!!!?(B.Fields.Append "ID", adLongVarChar, 10, adFldRowID ?$B!!!!?(B.Fields.Append "Name", adChar, 50, adFldUpdatable ?$B!!!!?(B.CursorType = adOpenKeyset ?$B!!!!?(B.LockType = adLockOptimistic ?$B!!!!?(B.Open End With As an example ..
dim DataTable as new DataTable() DataTable.Columns.Add("Foo", Type.GetType("System.String")) DataTable.Columns.Add("Bar", Type.GetType("System.Int32")) You can also get into alot more properties of the DataColumn if you use the form dim Column as new DataColumn() 'set some properties on the column DataTable.Columns.Add(Column) Cheers, Greg Show quote "Zoo" <ayama***@infoseek.jp> wrote in message news:%23ec$mBqaGHA.4144@TK2MSFTNGP04.phx.gbl... > Hi,All. > > I have the code written below which runs on VB6 and ADO. > And I want migrate this onto VB.NET 2003 and ADO.NET. > Could anybody give me a sample? > > Dim Rs As New ADODB.RecordSet > With Rs > ?$B!!!!?(B.Fields.Append "ID", adLongVarChar, 10, adFldRowID > ?$B!!!!?(B.Fields.Append "Name", adChar, 50, adFldUpdatable > ?$B!!!!?(B.CursorType = adOpenKeyset > ?$B!!!!?(B.LockType = adLockOptimistic > ?$B!!!!?(B.Open > End With > Thank you Greg Young.
I didn't know DataTable. I just knew only DataReader. It's thanks to you that I know DataTable. That helps me so much. Show quote "Greg Young [MVP]" <DruckDruckGo***@hotmail.com> wrote in message news:eJWgdQqaGHA.4564@TK2MSFTNGP03.phx.gbl... > As an example .. > > dim DataTable as new DataTable() > DataTable.Columns.Add("Foo", Type.GetType("System.String")) > DataTable.Columns.Add("Bar", Type.GetType("System.Int32")) > > You can also get into alot more properties of the DataColumn if you use the > form > > dim Column as new DataColumn() > 'set some properties on the column > DataTable.Columns.Add(Column) > > Cheers, > > Greg > "Zoo" <ayama***@infoseek.jp> wrote in message > news:%23ec$mBqaGHA.4144@TK2MSFTNGP04.phx.gbl... > > Hi,All. > > > > I have the code written below which runs on VB6 and ADO. > > And I want migrate this onto VB.NET 2003 and ADO.NET. > > Could anybody give me a sample? > > > > Dim Rs As New ADODB.RecordSet > > With Rs > > ?$B!!!!?(B.Fields.Append "ID", adLongVarChar, 10, adFldRowID > > ?$B!!!!?(B.Fields.Append "Name", adChar, 50, adFldUpdatable > > ?$B!!!!?(B.CursorType = adOpenKeyset > > ?$B!!!!?(B.LockType = adLockOptimistic > > ?$B!!!!?(B.Open > > End With > > > > Greg,
It is as this in the documentation on MSDN where it is completely copied from C# However this goes as well and you can than use the intellisence from VBNet dim DataTable as new DataTable() DataTable.Columns.Add("Foo", GetType(System.String)) DataTable.Columns.Add("Bar", GetType(System.Int32)) Just to let you know for next time. Cor |
|||||||||||||||||||||||