PC Review


Reply
Thread Tools Rate Thread

Column names with spaces

 
 
steven_licciardinnoossppaamm@hotmail.com
Guest
Posts: n/a
 
      17th Nov 2003
Does anyone have an example of constructing command
strings using column names with spaces? For example I
have :

Dim strCommUpd As String = "UPDATE DTable SET [AESLRef]=@
[AESLRef], [Test Column]=@[Test Column] WHERE ID=@ID"

My parameters would then take the form:

commUpd.Parameters.Add("@[AESLRef]", sqlDBType.VarChar,
50, "[AESLRef]")

commUpd.Parameters.Add("@[Test Column]",
sqlDBType.DateTime, 8, "[Test Column]")

When I try and do an update to save changes in the data I
get an error of the form : Incorrect syntax near 'varchar'

If I get rid of the varchar column then the error
specifies the next type (i.e. Incorrect syntax
near 'datetime')

This is the same code that works for the column names
without spaces so I can only assume I have an error
somewhere else.

Thanks,

Steven

 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      17th Nov 2003
Stop. Do yourself a BIG favor and take out the spaces in object names. Yes,
there are ways to get this to work, but as soon as you get part of your app
working, another part will choke.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"(E-Mail Removed)"
<(E-Mail Removed)> wrote in message
news:004b01c3ad20$43811e80$(E-Mail Removed)...
> Does anyone have an example of constructing command
> strings using column names with spaces? For example I
> have :
>
> Dim strCommUpd As String = "UPDATE DTable SET [AESLRef]=@
> [AESLRef], [Test Column]=@[Test Column] WHERE ID=@ID"
>
> My parameters would then take the form:
>
> commUpd.Parameters.Add("@[AESLRef]", sqlDBType.VarChar,
> 50, "[AESLRef]")
>
> commUpd.Parameters.Add("@[Test Column]",
> sqlDBType.DateTime, 8, "[Test Column]")
>
> When I try and do an update to save changes in the data I
> get an error of the form : Incorrect syntax near 'varchar'
>
> If I get rid of the varchar column then the error
> specifies the next type (i.e. Incorrect syntax
> near 'datetime')
>
> This is the same code that works for the column names
> without spaces so I can only assume I have an error
> somewhere else.
>
> Thanks,
>
> Steven
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column Names with Embedded Spaces with the Text Driver zacks@construction-imaging.com Microsoft VB .NET 0 13th Dec 2005 03:38 PM
Column names with spaces in them giving me trouble nm Microsoft ADO .NET 3 10th Jun 2004 08:47 PM
Spaces in table names for use with asp =?Utf-8?B?S0JyYWQ=?= Microsoft Access 2 31st Mar 2004 07:29 PM
spaces in column names daniel mcgregor Microsoft Access Queries 1 7th Nov 2003 03:02 PM
Spaces between names Iain Microsoft Excel Worksheet Functions 2 12th Sep 2003 03:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:42 AM.