Erro de Convert

SQL Server

11/09/2006

olá,

Eu não sei converter esse erro alguem pode me ajudar? TENHO QUASE CERTEZA QUE É NO CAMPO CORRESPONDENCIA, POIS É UM CHECK BOX, MAS NÃO SEI PASSAR ESSA INSTRUÇÃO DE CONVERSÃO DO SQL PRO ´CODE´...

Syntax error converting the varchar value ´True´ to a column of data type bit.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Syntax error converting the varchar value ´True´ to a column of data type bit.

Source Error:


Line 36: ´INSERT INTO [T P Colaboradores] (......) VALUES ´(´´ & Link_Pai & ´´,´´ & Pai_ID & ´´,´´ & Filho_ID & ´´,´´ & Departamento & ´´,´´ & Complemento_do_Endereco & ´´,´´ & Cargo & ´´,´´ & Correspondencia & ´´, getdate() )´
Line 37: cmd = New SqlCommand(sSQL, cn)
Line 38: cmd.ExecuteNonQuery()
Line 39:
Line 40: cmd.Dispose()


Obrigado...
Aline


Aline.caldeira

Aline.caldeira

Curtidas 0

Respostas

Psergio.p

Psergio.p

11/09/2006

Caro amigo, faltam alguns dados para podermos ajuda-lo, precisamos da estrutura da tabela e saber os tipos de dados que estão sendo passados para a instrução sql.


GOSTEI 0
Psergio.p

Psergio.p

11/09/2006

Cara amiga, se o campo correspondencia é um check box então seus valores devem ser True ou False porém no banco de dados a coluna é Bit, então você deve fazer uma conversão,

Seria assim

Dim corr as byte

if correspondecia.Value then
corr = 1
else
corr = 0
end if

após isso substitua a variável correspondencia por corr na instução sql


Qualquer problema poste novamente!


GOSTEI 0
Aline.caldeira

Aline.caldeira

11/09/2006

Olá amigo mto obrigado, vlw...


isso me ajudou mto...

até +


GOSTEI 0
Psergio.p

Psergio.p

11/09/2006

Estamos aí para ajudar!


GOSTEI 0
POSTAR