TheDProgrammer
TheDProgrammer

Reputation: 95

Not able perform INSERT INTO Operation using VB .NET because of Space in the Column Name

I am trying to perform INSERT INTO Operation using SqlCommand in VB .NET. My DataTable has one Column with a space in its Name. Due to this column name I am not able to perform INSERT INTO Operation. I am getting an error message stating:

Incorrect Syntax near Column Name

I don't want to change the column name in the DataTable. Is there a way to fix this problem?

Upvotes: 0

Views: 159

Answers (2)

Mahesh Malpani
Mahesh Malpani

Reputation: 1989

Use [table name]. Same thing for columns. Means anything with spaces must be placed inside the braces as mentioned by Tushar

Upvotes: 0

Tushar Gupta
Tushar Gupta

Reputation: 15913

That can be rectified Just place your name in [], If naming is the only issue.

Upvotes: 2

Related Questions