|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AutoIncrement is generating null values? - OR - need to get Autonumber from Access db tableI'm trying to create a datarelationship between two tables in a dataset. I've turned the autoincrement switch on to an ID field, but it's not generating anything. I am a newbie, so I'm hoping it's nothing too difficult. Here is the code; Dim sql$ = "SELECT 0 AS Selected, VendorInventoryTypes.VendorInventoryTypesID, VendorInventoryTypes.Code, VendorInventoryTypes.Category, VendorInventoryTypes.SubCategory, VendorInventoryTypes.Brand, VendorInventoryTypes.Model, VendorInventoryTypes.Description, 0 AS Quantity, VendorInventoryTypes.RequiresUniqueItems,VendorInventoryTypes.Cost FROM (VendorInventoryTypes) WHERE (((VendorInventoryTypes.VendorID)=" & lclVendorID & "));" Dim dc As New DataColumn, dt As New DataTable dsInventoryTypeOrders = mdi.dt.GenericDS(sql) dc.AutoIncrement = True dc.AutoIncrementSeed = -1 dc.AutoIncrementStep = -1 dc.ColumnName = "ID" dsInventoryTypeOrders.Tables(0).Columns.Add(dc) Console.WriteLine(dsInventoryTypeOrders.Tables(0).Columns(11)) view1 = New DataView(dsInventoryTypeOrders.Tables(0)) view1.RowFilter = "Selected = 0" view2 = New DataView(dsInventoryTypeOrders.Tables(0)) view2.RowFilter = "Selected = 1" listAvailable.DataSource = view1 listSelected.DataSource = view2 Any help would be greatly appreciated. Thanks! Rico,
I don't see any relation to a relation in your sample, can you rephrase your question? Cor "Rico" <r c o l l e n s @ h e m m i n g w a y . c o mREMOVE THIS PART IN CAPS> schreef in bericht news:bxpNf.83977$B94.56486@pd7tw3no... Show quote > Hello, > > I'm trying to create a datarelationship between two tables in a dataset. > I've turned the autoincrement switch on to an ID field, but it's not > generating anything. I am a newbie, so I'm hoping it's nothing too > difficult. Here is the code; > > > Dim sql$ = "SELECT 0 AS Selected, > VendorInventoryTypes.VendorInventoryTypesID, VendorInventoryTypes.Code, > VendorInventoryTypes.Category, VendorInventoryTypes.SubCategory, > VendorInventoryTypes.Brand, VendorInventoryTypes.Model, > VendorInventoryTypes.Description, 0 AS Quantity, > VendorInventoryTypes.RequiresUniqueItems,VendorInventoryTypes.Cost FROM > (VendorInventoryTypes) WHERE (((VendorInventoryTypes.VendorID)=" & > lclVendorID & "));" > Dim dc As New DataColumn, dt As New DataTable > > dsInventoryTypeOrders = mdi.dt.GenericDS(sql) > dc.AutoIncrement = True > dc.AutoIncrementSeed = -1 > dc.AutoIncrementStep = -1 > dc.ColumnName = "ID" > dsInventoryTypeOrders.Tables(0).Columns.Add(dc) > > Console.WriteLine(dsInventoryTypeOrders.Tables(0).Columns(11)) > > view1 = New DataView(dsInventoryTypeOrders.Tables(0)) > view1.RowFilter = "Selected = 0" > view2 = New DataView(dsInventoryTypeOrders.Tables(0)) > view2.RowFilter = "Selected = 1" > > listAvailable.DataSource = view1 > listSelected.DataSource = view2 > > Any help would be greatly appreciated. > > Thanks! > Hi Cor,
Thanks for your response. I'm not at my desk right now but will forward you the code when I can. The problem isn't so much the relationship, it's not having the autoincr populate the column. Does a column HAVE to be bound to an underlying AutoNum field? Right now it's just returning nulls (with or without the relationship) I just wanted to see if I had that configured correctly to work. Rick Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%237JIW7cPGHA.3732@TK2MSFTNGP10.phx.gbl... > Rico, > > I don't see any relation to a relation in your sample, can you rephrase > your question? > > Cor > > "Rico" <r c o l l e n s @ h e m m i n g w a y . c o mREMOVE THIS PART IN > CAPS> schreef in bericht news:bxpNf.83977$B94.56486@pd7tw3no... >> Hello, >> >> I'm trying to create a datarelationship between two tables in a dataset. >> I've turned the autoincrement switch on to an ID field, but it's not >> generating anything. I am a newbie, so I'm hoping it's nothing too >> difficult. Here is the code; >> >> >> Dim sql$ = "SELECT 0 AS Selected, >> VendorInventoryTypes.VendorInventoryTypesID, VendorInventoryTypes.Code, >> VendorInventoryTypes.Category, VendorInventoryTypes.SubCategory, >> VendorInventoryTypes.Brand, VendorInventoryTypes.Model, >> VendorInventoryTypes.Description, 0 AS Quantity, >> VendorInventoryTypes.RequiresUniqueItems,VendorInventoryTypes.Cost FROM >> (VendorInventoryTypes) WHERE (((VendorInventoryTypes.VendorID)=" & >> lclVendorID & "));" >> Dim dc As New DataColumn, dt As New DataTable >> >> dsInventoryTypeOrders = mdi.dt.GenericDS(sql) >> dc.AutoIncrement = True >> dc.AutoIncrementSeed = -1 >> dc.AutoIncrementStep = -1 >> dc.ColumnName = "ID" >> dsInventoryTypeOrders.Tables(0).Columns.Add(dc) >> >> Console.WriteLine(dsInventoryTypeOrders.Tables(0).Columns(11)) >> >> view1 = New DataView(dsInventoryTypeOrders.Tables(0)) >> view1.RowFilter = "Selected = 0" >> view2 = New DataView(dsInventoryTypeOrders.Tables(0)) >> view2.RowFilter = "Selected = 1" >> >> listAvailable.DataSource = view1 >> listSelected.DataSource = view2 >> >> Any help would be greatly appreciated. >> >> Thanks! >> > > |
|||||||||||||||||||||||