开发者

'Incorrect syntax near 'X3'. The identifier that starts with........is too long

I trying to save datagridview data to the database. Here is my code.

Dim cmd3 As New SqlCommand("insert into Tab_sale_bill (Col_Date, Col_Time, Col_Bill_Id, Col_Bill_Ty, Col_Inv_No, Col_Acc_Ty, Col_Acc_Name, Col_Bar, Col_Pro_Name, Col_Color_Code, Col_Bra, pricategory, Col_HSN, Col_Sec, Col_Cate, Col_Subcate, Col_Pack_Size, Col_Quan, Col_Unit, COL_MRP, Col_Re_Rate, Col_C_Rate, Col_Rate_Ex, Col_Rate_Diff, Col_Dis_Val, Col_Inv_Val, Col_Taxable_Val, Col_Tax_Rate, Col_CGST, Col_SGST, Col_P_Rate, Col_P_Val, Col_Total_Val, Col_Freight, Col_Oth_Dis, Col_Bill_Amnt, Col_Multiunit, factoronoff, netdiscount, marginvalue, marginper, Col_Comm_Typ, Col_Comm, Col_Item_Id, Col_Cust_Name, Col_Mob, Col_GSTIN, Col_Cust_Add, Col_Narr, Col_User_Id, Col_User) values('" & row.Cells(0).Value & "', @time, '" & row.Cells(2).Value & "', '" & row.Cells(3).Value & "', '" & row.Cells(4).Value & "', '" & row.Cells(5).Value & "', '" & row.Cells(6).Value & "', '" & row.Cells(7).Value & "', '" & row.Cells(8).Value & "', '" & row.Cells(9).Value & "', '" & row.Cells(10).Value & "', @pricri, '" & row.Cells(12).Value & "', '" & row.Cells(13).Value & "', '" & row.Cells(14).Value & "', @subcate, '" & row.Cells(16).Value & "', '" & row.Cells(17).Value & "', '" & row.Cells(18).Value & "', @mrp, @rerate, @crate, @rateex, '" & row.Cells(23).Value & "', @disper, @totval, @taxableval, '" & row.Cells(27).Value & "', @cgst, @sgst, @prate, @pval, '" & row.Cells(32).Value & "', '" & row.Cells(33).Value & "', '" & row.Cells(34).Value & "', @debit, '" & row.Cells(36).Value & "', '" & row.Cells(37).Value & "', '" & row.Cells(41).Value & "', '" & row.Cells(42).Value & "', '" & row.Cells(43).Value & "', '" & row.Cells(48).Value & "', '" & row.Cells(49).Value & "', '" & row.Cells(50).Value & "', '" & row.Cells(51).Value & "', '" & row.Cells(52).Value & "', @gst, @address, '" & row.Cells(55).Value & "', '" & row.Cells(56).Value & "', '" & row.Cells(57).Value & "')", conn3)
                        cmd3.Parameters.Add("@debit", SqlDbType.NVarChar).Value = Decimal.Parse(row.Cells(35).Value)
                            cmd3.Parameters.Add("@time", SqlDbType.Time).Value = Date.Now.ToString("hh:mm:ss")
                        cmd3.Parameters.Add("@pricri", SqlDbType.NVarChar).Value = row.Cells(11).Value
                        cmd3.Parameters.Add("@subcate", SqlDbType.NVarChar).Value = row.Cells(15).Value
                        cmd3.Parameters.Add("@gst", SqlDbType.NVarChar).Value = row.Cells(53).Value
                        cmd3.Parameters.Add("@address", SqlDbType.NVarChar).Value = row.Cells(54).Value
                        cmd3.Parameters.Add("@mrp", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(19).Value)), 6)
                        cmd3.Parameters.Add("@rerate", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(20).Value)), 6)
                        cmd3.Parameters.Add("@crate", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(21).Value)), 6)
                        cmd3.Parameters.Add("@rateex", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(22).Value)), 6)
                        cmd3.Parameters.Add("@disper", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(24).Value)), 6)
                        cmd3.Parameters.Add("@totval", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(25).Value)), 6)
                        cmd3.Parameters.Add("@taxableval", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(26).Value)), 6)
                        cmd3.Parameters.Add("@cgst", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(28).Value)), 6)
                        cmd3.Parameters.Add("@sgst", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(29).Value)), 6)
                        cmd3.Parameters.Add("@prate", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(30).Value)), 6)
                        cmd3.Parameters.Add("@pval", SqlDbType.NVarChar).Value = Math.Round((Decimal.Parse(row.Cells(31).Value)), 6)
                        conn3.Open()
                        cmd3.ExecuteNonQuery()
                            conn3.Close()

This causes the error as: 'Incorrect syntax near 'X3'. The identifier that starts with '', '30', 'PCS', @mrp, @rerate, @crate, @rateex, '0', @disper, @totval, @taxableval, '18', @cgst, @sgst, @prate, @pval, '140049',' is too long. Maximum length is 128. Unclosed quotation mark after the character string '', '30', 'PCS', @mrp, @rerate, @crate, @rateex, '0', @disper, @totval, @taxableval, '18', @cgst, @sgst, @prate, @pval, '140049', '.'

Can you please tell me what is this error indicate. What can I solved this error. Thanks in A开发者_如何学Godvance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜