From: Pablo Nogues on
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.


From: spammtrapp on
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
From: Alberto Silva, MVP on
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_nogues(a)hotmail.com> escreveu na mensagem
news:OC$G3$7YKHA.4932(a)TK2MSFTNGP02.phx.gbl...
> 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.
>
>
>
> __________ 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



From: Pablo Nogues on
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" <albertosilva(a)mundomovel.removeuntildot.com> escribi�
en el mensaje news:9F81D745-F4EE-4FA5-9CAC-938AE73D07B9(a)microsoft.com...
> 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_nogues(a)hotmail.com> escreveu na mensagem
> news:OC$G3$7YKHA.4932(a)TK2MSFTNGP02.phx.gbl...
>> 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.
>>
>>
>>
>> __________ 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
>
>
>


From: Alberto Silva, MVP on
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_nogues(a)hotmail.com> escreveu na mensagem
news:#mez1p4ZKHA.4932(a)TK2MSFTNGP02.phx.gbl...
> 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" <albertosilva(a)mundomovel.removeuntildot.com> escribi�
> en el mensaje news:9F81D745-F4EE-4FA5-9CAC-938AE73D07B9(a)microsoft.com...
>> 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_nogues(a)hotmail.com> escreveu na mensagem
>> news:OC$G3$7YKHA.4932(a)TK2MSFTNGP02.phx.gbl...
>>> 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.
>>>
>>>
>>>
>>> __________ 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
>>
>>
>>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> 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) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com