473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Need some help with this code...

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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

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
Nov 20 '05 #1
5 1176
Cor
Hi EMW,

The question from the ds is not that difficult,
ds = dataset is not possible, it is strange you did not get an errormessage
in your IDE for that (dataset is a type), you can do

ds = new dataset (but than your ds is cleaned and looking of the sequence of
your code I think you don't want to do that)

I did look at the rest of your code, but I know to few from a full text
search from a SQL server to help you.

I think you have a better change for an answer the
public.dotnet.framework.adonet newsgroup or in a special SQL newsgroup.

I hope this did help so far?

Cor

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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

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...

Nov 20 '05 #2
Cor
Hi EMW,

The question from the ds is not that difficult,
ds = dataset is not possible, it is strange you did not get an errormessage
in your IDE for that (dataset is a type), you can do

ds = new dataset (but than your ds is cleaned and looking of the sequence of
your code I think you don't want to do that)

I did look at the rest of your code, but I know to few from a full text
search from a SQL server to help you.

I think you have a better change for an answer the
public.dotnet.framework.adonet newsgroup or in a special SQL newsgroup.

I hope this did help so far?

Cor

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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

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...

Nov 20 '05 #3
EMW
Not really ;)

The line ds=dataset is a comment by me for the ones reading this code...I
guess I should have put it different...

Thanks, though.
Eric.

"Cor" <no*@non.com> schreef in bericht
news:Oj**************@TK2MSFTNGP12.phx.gbl...
Hi EMW,

The question from the ds is not that difficult,
ds = dataset is not possible, it is strange you did not get an errormessage in your IDE for that (dataset is a type), you can do

ds = new dataset (but than your ds is cleaned and looking of the sequence of your code I think you don't want to do that)

I did look at the rest of your code, but I know to few from a full text
search from a SQL server to help you.

I think you have a better change for an answer the
public.dotnet.framework.adonet newsgroup or in a special SQL newsgroup.

I hope this did help so far?

Cor

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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

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...


Nov 20 '05 #4
EMW
Not really ;)

The line ds=dataset is a comment by me for the ones reading this code...I
guess I should have put it different...

Thanks, though.
Eric.

"Cor" <no*@non.com> schreef in bericht
news:Oj**************@TK2MSFTNGP12.phx.gbl...
Hi EMW,

The question from the ds is not that difficult,
ds = dataset is not possible, it is strange you did not get an errormessage in your IDE for that (dataset is a type), you can do

ds = new dataset (but than your ds is cleaned and looking of the sequence of your code I think you don't want to do that)

I did look at the rest of your code, but I know to few from a full text
search from a SQL server to help you.

I think you have a better change for an answer the
public.dotnet.framework.adonet newsgroup or in a special SQL newsgroup.

I hope this did help so far?

Cor

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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

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...


Nov 20 '05 #5
See my comments below.

OHM
EMW wrote:
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 & "'"
dbColumn.Datatype = "VARCHAR(1000)"
dbColumn.AllowNulls = False
dbTable.Columns.Add(dbColumn)
pgBar.Value += 1 'progressbar
Next
sqlServer.Databases.Item("sitelist").Tables.Add(db Table)

ds = dataset

The database is created but the table won't. The table wont what ??

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

thanks,
Eric


1.) When you say the last line do you mean '
sqlServer.Databases.Item("sitelist").Tables.Add(db Table) '

2.) I assume that the table has been newly created and did not contain any
information in it ?

3.) if you do a ex.ToString() at the point of exception, what is the
complete dump ?

If this doesent help, post the relevent or complete if its not too big (
project ( zipped up )

OHM




Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
7
by: thegreatest21 | last post by:
Right, I am making a Tax Calculator and need an array to store the data that has been typed in when the user is prompted. However, being completely new to Java I am having some difficulty getting to...
1
by: jhaydon | last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.