English 中文(简体)
varchar(max) + linq to sql
原标题:varchar(max) + linq to sql

我一栏是一栏,试图读到,但实地则以4 000个特性缩小。 I ve see similar questions, 但这些问题处于ql一侧。

我需要做些什么才能使整个领域进入?

例如:

using (DataContext dc = new DataContext())
{
    var foo = dc.foos.First();
    if (foo.Formula2.Length > 4000)
    {
        Console.WriteLine("success!");
    }
}

我曾尝试过像,制定文本Size,但其中没有改动:

dc.ExecuteCommand("SET TEXTSIZE 100000;");
var foo = dc.foos.First();

<><>UPDATE:

The server data type is varchar(max). The field in question is formula2: alt text

如果我尝试把这种类型改变为目标一类,那么我就获得DbType VarChar(TM)和类型系统之间的信息。 图2 类型t_PriceFormula中的目标没有得到支持。

任何建议?

最佳回答
问题回答

sounds like .net convert varchar to nvarchar i dont know how to directly solve it. but System.Text.Encoding might help try this

//1 set col in db to varbinary(max)

//2 and when u want to save to db
string formula = "...";
System.Data.Linq.Binary bin = new System.Data.Linq.Binary(System.Text.Encoding.ASCII.GetBytes());

//3 when u pull ou
    Binary bin = row.Formula2;
    string formula = System.Text.Encoding.ASCII.GetString(bin.ToArray());




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...