我正在使用FirebirdSql.Data.FirebirdClient;
我有SQL查询:
"SELECT * FROM TB_CLIENTES C JOIN TB_CLIENTES_ENDERECOS E ON (E.CLIENTE_COD = C.CLIENTE_COD AND E.ENDERECO_TIPO_COD =1) WHERE C.CLIENTE_COD LIKE :filtro ORDER BY C.RAZAO_SOCIAL"
对于make选择im,使用此代码:
string conexao = String.Format(integracao.Local, integracao.Usuario, integracao.Senha);
DbConnection connection = null;
DbCommand command = null;
connection = new FbConnection(conexao);
connection.Open();
command = new FbCommand(@integracao.ConsultaSQL, (FbConnection)connection);
if (integracao.TipoFiltro.Equals(TipoFiltroEnum.TEXTO)) { command.Parameters.Add(new FbParameter(":filtro", campoFiltro + "%")); }
else { command.Parameters.Add(new FbParameter(":filtro", campoFiltro)); }
DbDataReader dr = command.ExecuteReader();
我收到此异常:
FirebirdSql.Data.FirebirdClient.FbException: 'Dynamic SQL Error SQL error code = -206 Column unknown FILTRO At line 1, column 146' IscException: Dynamic SQL Error SQL error code = -206 Column unknown FILTRO At line 1, column 146
编辑:更改:到@filtro并解决问题
答案 0 :(得分:1)
Firebird ADO.net提供程序中的参数应以infile = open("empwages.txt","r")
masterList = infile.readlines()
nameList = []
hourList = []
plushourList = []
for master in masterList:
nameList.append(master.split()[0])
hourList.append(master.split()[1])
x = 2
while x <= 6:
plushourList.append(master.split()[x])
x += 1
print(nameList)
print(hourList)
print(plushourList)
符号而不是@
开头。
只需将您的代码更改为使用:
,它就可以正常工作。
SQL代码段:
@
C#代码段:
... WHERE C.CLIENTE_COD LIKE @filtro ORDER BY ...