Visual CSharp .NET - error String or binary data would be truncated.

   
Vista:

error String or binary data would be truncated.

Publicado por alexis (59 intervenciones) el 08/01/2015 00:15:00
buenas tardes que tal, estoy presentando el siguiente error en mi aplicacion web

estoy programando en c # y aspx 2008 con sql server me manda el siguiente error


String or binary data would be truncated.


en el codigo tengo lo siguiente

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
SqlParameter[] apParams = new SqlParameter[20];
apParams[0] = new SqlParameter("@i_opt", SqlDbType.Int);
 
apParams[0].Value = logistic.iOpt;
 
apParams[1] = new SqlParameter("@i_no_trx", SqlDbType.Int);
if (!String.IsNullOrEmpty(logistic.no_trx.ToString()))
{
    if (logistic.no_trx > 0)
        apParams[1].Value = logistic.no_trx;
}
 
apParams[2] = new SqlParameter("@i_doc_embarque_bhl", SqlDbType.Char, 30);
apParams[2].Value = logistic.doc_embarque_bhl;
apParams[3] = new SqlParameter("@i_ship_mode", SqlDbType.Char, 3);
apParams[3].Value = logistic.ship_mode;
apParams[4] = new SqlParameter("@i_forwarder", SqlDbType.Char, 12);
apParams[4].Value = logistic.forwarder;
apParams[5] = new SqlParameter("@i_freight_type", SqlDbType.Char, 10);
apParams[5].Value = logistic.freight_type;
apParams[6] = new SqlParameter("@i_status_sw", SqlDbType.Char, 3);
apParams[6].Value = logistic.estatus_sw;
apParams[7] = new SqlParameter("@i_incoterm", SqlDbType.Char, 3);
apParams[7].Value = logistic.incoterm;
apParams[8] = new SqlParameter("@i_country_shipment", SqlDbType.Char, 30);
apParams[8].Value = logistic.country_shipment;
apParams[9] = new SqlParameter("@i_port_loading", SqlDbType.Char, 5);
apParams[9].Value = logistic.port_loading;
apParams[10] = new SqlParameter("@i_receipt_place", SqlDbType.Char, 50);
apParams[10].Value = logistic.receipt_place;
apParams[11] = new SqlParameter("@i_destination_place", SqlDbType.Char, 50);
apParams[11].Value = logistic.destination_place;
apParams[12] = new SqlParameter("@i_no_po", SqlDbType.Char, 8);
apParams[12].Value = logistic.no_po;
apParams[13] = new SqlParameter("@i_pty", SqlDbType.Char, 30);
apParams[13].Value = logistic.no_pty;
apParams[14] = new SqlParameter("@i_style_code", SqlDbType.Char, 15);
apParams[14].Value = logistic.no_style;
apParams[15] = new SqlParameter("@i_isxls", SqlDbType.Int);
if (logistic.isXLS == 1)
    apParams[15].Value = logistic.isXLS;
 
//Fecha inicial ATS
apParams[16] = new SqlParameter("@i_ats", SqlDbType.DateTime);
apParams[16].Value = logistic.ats;
 
//Fecha fin ATS
apParams[17] = new SqlParameter("@i_ats_fecha_fin", SqlDbType.DateTime);
apParams[17].Value = logistic.atsFechaFin;
 
apParams[18] = new SqlParameter("@i_no_contenedor", SqlDbType.Char, 100);
apParams[18].Value = logistic.no_contenedor;
 
apParams[19] = new SqlParameter("@i_family", SqlDbType.Char, 49);
apParams[19].Value = logistic.family;
 
 
dts = new DataSet();
dts = DataLog.dtSP("sp_po_log_cons_bl", apParams, ref errorInfo);


en algunos caso sale ese error en otro no

en sql esta declarado
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@i_opt                   int         =   NULL,
@i_no_trx               int         =   NULL,
@i_doc_embarque_bhl     char(30)    =   NULL,
@i_ship_mode            char(3)     =   NULL,
@i_forwarder            char(12)    =   NULL,
@i_freight_type         char(10)    =   NULL,
@i_status_sw            char(10)    =   NULL,
@i_incoterm             char(3)     =   NULL,
@i_country_shipment     char(30)    =   NULL,
@i_port_loading         char(5)     =   NULL,
@i_destination_place    char(50)    =   NULL,
@i_receipt_place        char(50)    =   NULL,
@i_no_po                char(8)     =   NULL,
@i_pty                  char(30)    =   NULL,
@i_style_code           char(15)    =   NULL,
@i_isxls                int         =   NULL,
@i_ats                  datetime    =   NULL,
@i_ats_fecha_fin         datetime    =   NULL,
@i_no_contenedor        char(100)   =   NULL,
@i_family               char(49)    =   NULL
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder