如何为名称中的空格创建列的复杂数据类型? [英] How to create complex datatype for column with spaces in the name?

查看:141
本文介绍了如何为名称中的空格创建列的复杂数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程,在列名中返回带空格和破折号的列。我不能简单地使用获取列信息按钮为此存储过程自动生成复杂类型。



如何处理字段名称中的空格和破折号,因为它们不是C#中字段名称的合法字符。

解决方案

我找到了这个答案。



继续创建复杂的类型,替换列名称中的空格的下划线,或按照您喜欢命名复杂类型中的字段的任何惯例。



然后,在模型浏览器中单击您的功能导入。在Visual Studio 2010窗口的底部,应该有一个选项卡,其中显示映射详细信息。在这里,您可以指定与复合类型中每个字段对应的列的名称。用这里的空格键入列名称。


I have a stored procedure that returns columns with spaces and dashes in the column names. I cannot simply use the "Get Column Information" button to automatically generate a complex type for this stored procedure.

How do I handle the spaces and dashes in the field names since they are not legal characters for field names in C#?

解决方案

I found the answer to this.

Go ahead and create the complex type substituting underscores for spaces in the column names or follow whatever convention you like naming the fields in the complex type.

Then, click on your function import in the Model Browser. At the bottom of the Visual Studio 2010 window, there should be a tab that says "Mapping Details". Here, you can specify the name of the column that corresponds to each field in your complex type. Type in the column names with the spaces here.

这篇关于如何为名称中的空格创建列的复杂数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆