Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sqlce drop table

7 views
Skip to first unread message

Pablo Nogues

unread,
Nov 12, 2009, 12:45:44 PM11/12/09
to
Hi, i�ve a method that expects a string parameter (table name to drop ) in
CF 3.5 C#, that returns error. My code is:


..........//

cmd.CommandText = "Delete @Table" ;

cmd.CommandType = System.Data.CommandType.Text;

cmd.Parameters.AddWithValue("@Table", table);

-------------//

My cuestion is why i can�t call in this way ?

Thanks in advanced.


Christian Resma Helle

unread,
Nov 12, 2009, 4:14:49 PM11/12/09
to
Try DROP TABLE @Table

Regards,
Christian Resma Helle
http://christian-helle.blogspot.com

Pablo Nogues

unread,
Nov 13, 2009, 6:45:32 AM11/13/09
to
Hi Christian, i wan�t to drop the table, y need only delete it.

Any idea ?

thanks!

"Christian Resma Helle" <xtia...@gmail.com> escribi� en el mensaje
news:101a95940d248...@msnews.microsoft.com...

spammtrapp

unread,
Nov 13, 2009, 7:54:31 AM11/13/09
to
Pablo Nogues pisze:
> Hi Christian, i wan�t to drop the table, y need only delete it.

So what is the difference between drop and delete the table?

If you want REMOVE TABLE from the database use
drop table name

but if you want REMOVE DATA FROM THE TABLE use

delete from name

Alberto Silva, MVP

unread,
Nov 16, 2009, 8:19:57 AM11/16/09
to
The problem may be with replacing the object system name with a parameter.
If you embed the table name in the DELETE command, it works as expected,
right?

Alberto Silva

"Pablo Nogues" <pablo_...@hotmail.com> escreveu na mensagem
news:OC$G3$7YKHA...@TK2MSFTNGP02.phx.gbl...

> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4600 (20091112) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4611 (20091116) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Pablo Nogues

unread,
Nov 17, 2009, 8:32:56 AM11/17/09
to
Yes, you are right Alberto.

The problems is when is user a command parameter with the name of my table.

Any idea ?

thanks


"Alberto Silva, MVP" <albert...@mundomovel.removeuntildot.com> escribi�
en el mensaje news:9F81D745-F4EE-4FA5...@microsoft.com...

Alberto Silva, MVP

unread,
Nov 18, 2009, 5:10:18 AM11/18/09
to
Hola Pablo,
Why don't you just 'concatenate' the table name to the "DELETE FROM "
command? Or if you prefer, keep the "DELETE FROM @table" command string, but
when executing, replace yourself with string manipulation functions,
"@table" with the table name.

Alberto Silva

"Pablo Nogues" <pablo_...@hotmail.com> escreveu na mensagem

news:#mez1p4Z...@TK2MSFTNGP02.phx.gbl...

> signature database 4616 (20091117) __________


>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4616 (20091117) __________

0 new messages