ورود

View Full Version : ارور : String or binary data would be truncated



shervinrv
دوشنبه 14 آبان 1386, 01:30 صبح
دوستان من وقتی سعی میکنم توی جدول اینسرت کنم دچار این ارور میشم
جالبه اصلا متن طولانی نیست و یه متن اچ تی ام ال کوتاه هست
ضمن اینکه متن اچ تی ام ال تو همین پروژه هم میریزم تو دیتا بیس و ارور نمیگیرم ینی بعید میدون واسه html بودنش باشه
ضمنا بزرگترین فیلد هارو هم امتحان کردم باز این ارور میاد
جالبه دیروز کار میکرد بدون ارور
امروز دوباره پروژه رو باز کردم بدون اینکه کاری بکنم این ارور رو میگیرم اصلا هم درست نمیشه
هرچی سرچ میکنم میبینم گفتم اندازه فیلدت کوچیکه ولی 7-8 خط متن که چیز بزرگی نیست اونم در مقابل متنای طولانی که خودم قبلا وارد دیتا بیس کردم
ممنون میشم یکی یه راهنمایی بکنه

shervinrv
دوشنبه 14 آبان 1386, 11:22 صبح
ینی کسی جواب سوال منو نمیدونه؟
کارم خیلی گیره
کل پروژه خوابیده سر همین ارور

hdv212
دوشنبه 14 آبان 1386, 12:06 عصر
میشه نوع فیلد جدولتو بگیر و همچنین کد Insert رو ؟

shervinrv
دوشنبه 14 آبان 1386, 12:11 عصر
میشه نوع فیلد جدولتو بگیر و همچنین کد Insert رو ؟
ممنون بابت توجهت
نوع فیلد در حال حاضر ntext هست
ولی میگم همه نوع فیلدی رو امتحان کردم
اینم کد

cm = New SqlCommand("insert into pages(bookid,titleb,textb,fname,cat) values(@bid,@title,@text,@fname,@cat)", cn)
cm.Parameters.Add("@bid", bid)
cm.Parameters.Add("@title", tagcon.Replace(" ", "_"))
cm.Parameters.Add("@text", tempsource)
cm.Parameters.Add("@fname", fname)
cm.Parameters.Add("@cat", catid)

shervinrv
دوشنبه 14 آبان 1386, 12:23 عصر
اینم متن اولین فایلی که ازش ایراد میگیره و نمیریزه
خودتون ببینید چقدر کوتاهه

<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>What Is a Beta?</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01a.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01alev1sec2.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><TR><TD valign="top"><a name="ch01alev1sec1"></a>
<h3 id="title-IDAGNJQG" class="docSection1Title">What Is a Beta?</h3>
<p class="docText">When software vendors work on a new or updated program, they perform extensive in-house testing of the new version. This is called <span class="docEmphasis">alpha testing</span>, and each new version of the software-in-progress is called an <span class="docEmphasis">alpha</span>.</p>
<p class="docText">A <span class="docEmphasis">beta</span>, a term you've probably heard used 3 or 4 or 20,000 times or so, is a later version of the prerelease program that the company distributes to outside users for testing and feedback. The process of third-party distribution, testing, and feedback is called a <span class="docEmphasis">beta test</span>, and the users who put the program through its paces are called <span class="docEmphasis">beta testers</span>.</p>
<a name="ch01anote01"></a><div class="docNote"><p class="docNoteTitle">Note</p>

<p class="docText">Because the alpha test is an &quot;in-house&quot; procedure, many a wag has dubbed the beta test an &quot;out-house&quot; procedure. Also, because software with even the most thoroughly tested alpha and beta versions behind it will still ship with more than a few bugs, other wags (or possibly the same ones) have taken to calling the released product the <span class="docEmphasis">gamma version.</span></p>
</div><br>
<p class="docText">The software industry has used the terms <span class="docEmphasis">alpha</span> and <span class="docEmphasis">beta</span> since the early 1980s, but they date back to the 1960s in the hardware world. In fact, the terms are thought to have originated at IBM in the early 1960s and come from that company's use of the terms <span class="docEmphasis">A-test</span> and <span class="docEmphasis">B-test</span> for the initial testing of new hardware components.</p>
<p class="docText">Microsoft first started beta-testing its software in the early 1980s, and almost all of its operating systems have run through a beta-testing cycle (the possible exception is the original version of MS-DOS). The old DOS beta cycles had perhaps a few hundred testers, but in recent years the Windows beta test brigade has mushroomed. The Whistler (Windows XP) beta test had a whopping half a million users, who combined to discover tens of thousands of bugs, big and small. The numbers in the Longhorn/Vista beta test have been even bigger. Although the first beta was distributed to just 10,000 users (but was also made available to a few hundred thousand Microsoft Developer Network and TechNet subscribers), it was estimated that up to 2 million people would take a crack at Beta 2, the first build made available to the general public.</p>
<p class="docText">What do Windows beta testers do? Those of us who take our beta-testing duties seriously end up doing quite a bit, actually. You have to install each beta, of course, which is no small feat in itself because you have to download a 3GB file, burn that file to a DVD, wipe everything from your test machine, run the setup program, and then tweak your device drivers, depending on the level of driver support in the beta you're installing. Then you need to fill out an installation survey and possibly a hardware survey. Then, most importantly, you need to use the operating system in various scenarios to see if everything works the way it should. If it doesn't, you need to submit a bug report to Microsoft. While you're doing this, you also need to read and participate in the beta newsgroups, follow or contribute to the periodic live chats with the developers, and try out the &quot;feature previews&quot; and report your results. Add to this the necessary (but not for the beta) tasks of studying Microsoft's whitepapers and briefing notes for all the new technologies, following the blogs related to the new OS, keeping tabs on the Microsoft &quot;rumor&quot; sites, and all the while writing up your findings in such a way that people such as yourself will know what to expect. It's hard but very satisfying work, and one of the more tangible results of it all is the book that you now hold in your hands.</p>
<a name="ch01anote02"></a><div class="docNote"><p class="docNoteTitle">Note</p>


<p class="docText">There's a popular and appealing tale of how the word <span class="docEmphasis">bug</span> came about. Apparently, an early computer pioneer named Grace Hopper was working on a machine called the Mark II in 1947. While investigating a glitch, she found a moth among the vacuum tubes, so from then on glitches were called bugs. Appealing, yes, but true? Not quite. In fact, engineers had already been referring to mechanical defects as &quot;bugs&quot; for at least 60 years before Ms. Hopper's discovery. As proof, the <span class="docEmphasis">Oxford English Dictionary</span> offers the following quotation from an 1889 edition of the <span class="docEmphasis">Pall Mall Gazette</span>:</p>
<p class="docText">&quot;Mr. Edison, I was informed, had been up the two previous nights discovering 'a bug' in his phonographan expression for solving a difficulty, and implying that some imaginary insect has secreted itself inside and is causing all the trouble.&quot;</P>
</div><br>

<a href="29021536.html"><img src="images/pixel.jpg" alt="" width="1" height="1" border="0"></a></TD></TR></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01a.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01alev1sec2.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
</body></html>

hdv212
دوشنبه 14 آبان 1386, 15:21 عصر
فکر کنم اگه به جای فیلد ntext یه فیلد به صورت nvarchar(max) بسازی و داده هات رو به صورت آرایه ای char ذخیره کنی مشکلت حل بشه، اینطوری فکر نمیکنم راهی برای ذخیره شدن باشه، با فیلد xml هم تست کردم نشد، یه راه دیگه هم اینه که میتونی یه فیلد از نوع varbinary(max) ایجا کنی و متنتو به صورت باینری توش ذخیره کنی.

anubis_ir
دوشنبه 14 آبان 1386, 15:32 عصر
شما باید تمام ' ها را با '' با استفاده از تابع replace ، جایگزین کنید.

shervinrv
دوشنبه 14 آبان 1386, 18:45 عصر
دوستان هیچ مدلی درست نمیشه اشکال که به هیچ عنوان از ' نیست چون قبلا امتحان کرده بودم
هر مدلی هم بگید نوع فیلد هارو گذاشتم بازم ارور میده varchar میزارم اینو میگه
Disallowed implicit conversion from data type ntext to data type varchar, table 'html2sql.dbo.pages', column 'textb'. Use the CONVERT function to run this query.
بعد هرچی میزنم بابا نوع این تکست رو varvhar بفرست باز یه ارور دیگه میده
میگه یه اینت نمیتونم کانورت کنم حالا ورچر چه ربطی به اینت داره نمیدونم بعد که ساز هم بهش میدم باز همون ارور بالا که نوشتمو میگه
بدجوری گیج شدم
باینری هم جواب نداد
با توجه به اینکه قبلا زیاد html ریختم تو دیتا بیس الان خیلی خیلی برام عجیبه

shervinrv
دوشنبه 14 آبان 1386, 21:51 عصر
مشکل خیلی به نظرم مسخره میاد
هر وقت Enterprise manager باز باشه ارور میده و هر وقت بسته باشه ارور نمیده :O