Error with SQL Server Stored Procedure & C# -


I am developing a stored procedure to obtain a register from the table, so I created the following query to get it :

  Alternate Processes [DBO]. [Process_odd] @CodeCCNINT, Nomodes Varna (500), @ Kod Mate varchar (500) as Ghora varchar (50); Set @ hora = (ra_hpl_horarios_planificacion), select b.man_nomhor at Hpl_codman = b.man_codigo where an .hpl_codcil = 100 and a.hpl_codemp = (select emp_codigo from pla_emp_empleado where emp_nombres_apellidos = @NomDoce) and a.hpl_codmat = @ codMate and a.hpl_descripcion = @codSeccion) @hora end   

I have this query is tested (query stored procedure with the query) and it works just fine in my SQL server console Does. The problem is that when I call it from C #, I still do not try to do the work! Apart from this, I tried to develop a stored procedure with the output parameter but there were no results.

In addition, I have other ways to try (which is very good and works fine!):

  select an internal b.man_nomhor ra_hpl_horarios_planificacion ra_man_grp_horb but one. Hpl_codman = b.man_codigo on where one. Hpl_codcil = 100 and one. Hpl_codemp = (select emp_codigo from pla_emp_empleado where Emp_nombres_apellidos = 'Julio Escobar') and a.hpl_codmat = 'FONO-I' and a.hpl_descripcion = 1;   

Here's my code is C # (My solution 11000):

  public string Horrios (Int Sekgian, string Nomdest, string Codmat) {cn.Open (); CMD Connection = CN; Cmd.CommandText = "select b.man_nomhor from ra_hpl_horarios_planificacion Select emp_codigo on a.hpl_codman = b.man_codigo where a.hpl_codcil = 100 and a.hpl_codemp = (pla_emp_empleado) where Emp_nombres_apellidos = '" + + NomDocent "') and a. Hpl_codmat = ' "+ CodMate +"' and. Hpl_descripcion = ' "+ Seccion +"' '; Dr = cmd.ExecuteReader (); if (Dr. Acsaro) {if (dr.Read ()) {msj = Dr [0] .tostring ();}} Cn.close (); Return MSJ;}   

When I run my Visual Studio, it does not show any errors, Rather it sets an empty STRING like MSJ = "" in the transcript of MSJX " ;

It should be really easy, but this is just (trust) I have worked so hard to solve with Bino results, please help!

It looks like Seccion (and thus a. Hpl_descripcion ) are integers, but your query is keeping Epoproft around it like a literal

Try removing apostrophes:

  ... + "'And a.plpl_descripcion =" + peak;   

If this is indeed the issue, then the parameter of your query can eliminate these types of errors:

  cmd.CommandText = ".. And a.hpl_codemp = (select Emp_codigo from Emp_nombres_apellidos = @NomDocent) and a.hpl_codmat = @CodMate and a.hpl_descripcion = @ Seccion "; CMD. Adpameter with value ("@omomodocent", nomadocent); CMD. Adapamator with value ("@ kodmatt", codmat); Cmd.AddParameterWithValue ("@ Seccion, Seccion); dr = cmd.ExecuteReader ();    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -