DataReader、DataColumn - 这些可以显示架构中的列(例如 SomeSchema.SomeColumn)吗?
我有一个数据库表,其中列位于多个模式中。示例:
SomeTable SomeSchema.Column1 SomeSchema.Column2 AnotherSchema.ColumnA AnotherSchema.ColumnB
我有使用 DataTable.Rows[r][c].ToString()
语法的代码,它看起来只有 Column1
或 ColumnA
> 部分正在退回。我需要获取全名 SomeSchema.Column1
因为现在代码似乎抛出了未找到 Column1 的 Sql 异常。我假设如果我可以将其引用为 SomeSchema.Column1
这将纠正异常。我可以使用 DataTable
或 DataColumn
获取此信息,还是需要采取其他方法来实现此目的?有什么想法吗?我用“C# datatable datacolumn schema table dbo”等关键字搜索了 Google 和这个网站,但运气不佳。
I have a database table where columns are in multiple schemas. Example:
SomeTable SomeSchema.Column1 SomeSchema.Column2 AnotherSchema.ColumnA AnotherSchema.ColumnB
I have code using a DataTable.Rows[r][c].ToString()
syntax and it looks like only the Column1
or ColumnA
part is being returned. I need to get the full name SomeSchema.Column1
as right now it seems the code is throwing a Sql Exception with Column1 not found. I'm assuming that if I can reference it as SomeSchema.Column1
that this will correct the exception. Can I get this using a DataTable
or DataColumn
or is there another approach I need to take for this? Any ideas? I have searched Google and this site with such keywords as "C# datatable datacolumn schema table dbo" and have not had much luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LMAO,我已经在这方面工作太久了,没有休息,我想...这不是具有架构的列,而是表,所以我想我可以调整我的查询以获取具有架构的表名我认为将直接输入到我现有的代码中,一切都会好起来...我会在完成并测试后发回...叹息...
LMAO, I've been working on this too long without a break I think... it's not the columns that have the schema, it is the table, so I think I can tweak my query to get the table name with the schema which I think will feed right in to my existing code and all will be good... I'll post back after it's done and tested... sigh...