yaniv Posted June 9, 2003 Posted June 9, 2003 i"m creating an app. that supposed to give the user the opportunity to build himself a table and to edit it in the future. The problem is that in the first reading of the dataset (when the user didn't create the first table), the dataset return nothing and I get the massage "there's no row in position 0") . I tried to create a "virtual" table, like this: if myDS.tables(0).rows.count <=0 then Dim dr As DataRow Dim table1 As DataTable table1 = myDS.Tables.Add("Table1") for o = 0 to 18 ' I have 19 colums in the final tables table1.Columns.Add() next dr = table1.NewRow() for o = 0 to 18 dr(o) = "" table1.Rows.Add(dr) next o But I still get the "there's no row in position 0" !! Do you have a solution for this problem? Quote
*Experts* Nerseus Posted June 9, 2003 *Experts* Posted June 9, 2003 I think you want to check the Tables.Count property first. Try something like: if myDS.Tables.Count = 0 Then Dim dr As DataRow Dim table1 As DataTable table1 = myDS.Tables.Add("Table1") for o = 0 to 18 ' I have 19 colums in the final tables table1.Columns.Add() next dr = table1.NewRow() for o = 0 to 18 dr(o) = "" table1.Rows.Add(dr) next o end if -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.