I need some help with this code....

  • Thread starter Thread starter EMW
  • Start date Start date
E

EMW

Hi,

Can someone please look at this code and tell me why I get an exception
error on the last line:

For aa = 0 To ds.Tables(0).Columns.Count - 1
dbColumn = New SQLDMO.Column
dbColumn.Name = "'" & ds.Tables(0).Columns(aa).Caption & "'" 'ds is
the dataset
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(dbTable) 'On this line
I get an exception error.


The database is created but the table won't.

The exception error tells me only how the column definition should be, and
as far as I know I have it right...

thanks,
Eric
 
Found it!

it was the VARCHAR(1000) it should have been VARCHAR en the length of the
column should be set on a number
 
Back
Top