Строковые или двоичные данные будут усечены. Выполнение данной инструкции было прервано
это мой запрос на создание таблицы
SQLFcmd.CommandText = " CREATE TABLE [dbo].[Assets] ([AssetID][nvarchar](50) NULL,[AssetBarcode][nvarchar](50) NULL,[AssetName][nvarchar](50) NULL,[AssetType][nvarchar](50) NOT NULL,[AssetDesc][nvarchar](50) NULL,[Store][nvarchar](50) NULL,[AssetLocation][nvarchar](75) NULL,[Manufacture][nvarchar](50) NULL,[Brand][nvarchar](50) NULL,[Model][nvarchar](50) NULL,[AssetMore][nvarchar](50) NULL,[AssetSNo][nvarchar](50) NULL,[AssetTotal][nvarchar](50) NULL,[PhotoPath][nvarchar](50) NULL,[Status][nvarchar](10) NULL,[Condition][nvarchar](10) NULL,[AssetExpiry][Datetime]NULL,[AssetNotes][nvarchar](100) NULL,[AssetVendor][nvarchar](50) NULL,[AssetPurRate][float](10) NULL,[AssetScrap][nvarchar](50) NULL,[AssetYear][varchar](10) NULL,[AssetPurDate][Datetime] NULL,[AssetServiceStartDate][Datetime] NULL,[AssetWarranty][Datetime] NULL,[AssetDepreciation][nvarchar](50) NULL,[AssetDepreciationRate][nvarchar](50) NULL)ON [PRIMARY] " SQLFcmd.CommandType = CommandType.Text SQLFcmd.ExecuteNonQuery()
теперь это мой запрос вставить
MainForm.Cursor = Cursors.WaitCursor Dim SqlStr As String = "" 'If IsOpenForAlter = True Then SqlStr = "UPDATE Assets SET [dbo].[AssetID]=@AssetID [AssetBarcode]=@AssetBarcode,[AssetName]=@AssetName,[AssetType]=@AssetType,[AssetDesc]=@AssetDesc,[Store]=@Store,[AssetLocation]=@AssetLocation,[Manufacture]=@Manufacture,[Brand]=@Brand,[Model]=@Model,[AssetMore]=@AssetMore,[AssetSNo]=@AssetSNo,[AssetTotal]=@AssetTotal,[PhotoPath]=@PhotoPath,[Status]=@Status,[Condition]=@Condition,[AssetExpiry]=@AssetExpiry,[AssetNotes]=@AssetNotes,[AssetVendor]=@AssetVendor,[AssetPurRate]=@AssetPurRate,[AssetScrap]=@AssetScrap,[AssetYear]=@AssetYear,[AssetPurDate]=@AssetPurDate,[AssetServiceStartDate]=@AssetServiceStartDate,[AssetWarranty]=@AssetWarranty,[AssetDepreciation]=@AssetDepreciation,[AssetDepreciationRate]=@AssetDepreciationRate, WHERE AssetName=N'" & OpenedAssetName & "'" 'Else SqlStr = "INSERT INTO [dbo].[Assets] ([AssetID],[AssetBarcode],[AssetName],[AssetType],[AssetDesc],[Store],[AssetLocation],[Manufacture],[Brand],[Model],[AssetMore],[AssetSNo],[AssetTotal],[PhotoPath],[Status],[Condition],[AssetExpiry],[AssetNotes],[AssetVendor],[AssetPurRate],[AssetScrap],[AssetYear],[AssetPurDate],[AssetServiceStartDate],[AssetWarranty],[AssetDepreciation],[AssetDepreciationRate]) VALUES " _ & " (@AssetID,@AssetBarcode,@AssetName,@AssetType,@AssetDesc,@Store,@AssetLocation,@Manufacture,@Brand,@Model,@AssetMore,@AssetSNo,@AssetTotal,@PhotoPath,@Status,@Condition,@AssetExpiry,@AssetNotes,@AssetVendor,@AssetPurRate,@AssetScrap,@AssetYear,@AssetPurDate,@AssetServiceStartDate,@AssetWarranty,@AssetDepreciation,@AssetDepreciationRate) " 'End If Try MAINCON.ConnectionString = ConnectionStrinG MAINCON.Open() Dim DBF As New SqlClient.SqlCommand(SqlStr, MAINCON) With DBF.Parameters ' If Integer.TryParse(TxtAssetID.Text, id) Then 'DBF.Parameters.AddWithValue("@AssetID", id) 'Else '' The text in the textbox was not a valid integer representation. '' You may have to handle that case here. 'End If .AddWithValue("@AssetID", TxtAssetID.Text) .AddWithValue("@AssetBarcode", TxtAssetBarcode.Text) .AddWithValue("@AssetName", TxtAssetName.Text) .AddWithValue("@AssetType", TxtAssetType.Text) .AddWithValue("@AssetDesc", TxtDescr.Text) .AddWithValue("@Store", TxtStoreName.Text) .AddWithValue("@AssetLocation", TxtLocation.Text) .AddWithValue("@Manufacture", TxtManufacture.Text) .AddWithValue("@Brand", TxtBrand.Text) .AddWithValue("@Model", TxtModel.Text) .AddWithValue("@AssetMore", TxtMoreInfo.Text) .AddWithValue("@AssetSNo", TxtSerialNumber.Text) .AddWithValue("@AssetTotal", TxtQty.Text) .AddWithValue("@PhotoPath", PhotoPathForLedgers & "\Others\" & TxtAssetName.Text & ".jpg") .AddWithValue("@Status", TxtAssetStatus.Text) .AddWithValue("@Condition", txtCondition.Text) .AddWithValue("AssetExpiry", TxtExpiry.Value) .AddWithValue("@AssetNotes", TxtNote.Text) .AddWithValue("@AssetVendor", TxtVendorName.Text) .AddWithValue("@AssetPurRate", TxtPurRate.Text) .AddWithValue("@AssetScrap", TxtScrapValue.Text) .AddWithValue("@AssetYear", TxtYears.Text) .AddWithValue("@AssetPurDate", TxtpurchaseDate.Value) .AddWithValue("@AssetServiceStartDate", TxtServiceStartDate.Value) .AddWithValue("@AssetWarranty", TxtWarrantyDate.Value) .AddWithValue("@AssetDepreciation", TxtDepreMethod.Text) .AddWithValue("@AssetDepreciationRate", TxtDepRate.Text) End With DBF.ExecuteNonQuery() DBF = Nothing MAINCON.Close() Catch ex As Exception MsgBox(ex.Message) End Try Dim OpenedID As Integer = 1 Dim cnn As SqlConnection cnn = New SqlConnection(ConnectionStrinG) cnn.Open() Dim ds As New DataSet() MainForm.Cursor = Cursors.WaitCursor
Что я уже пробовал:
я изменил длину на 255, но происходит та же ошибка ,любой, пожалуйста, помогите заранее спасибо
CHill60
Изменил какую длину? Только вы знаете, что находится в переменных