DataReader、DataColumn - 这些可以显示架构中的列(例如 SomeSchema.SomeColumn)吗?

发布于 2024-09-11 04:28:22 字数 543 浏览 2 评论 0原文

我有一个数据库表,其中列位于多个模式中。示例:

SomeTable
SomeSchema.Column1
SomeSchema.Column2
AnotherSchema.ColumnA
AnotherSchema.ColumnB

我有使用 DataTable.Rows[r][c].ToString() 语法的代码,它看起来只有 Column1ColumnA > 部分正在退回。我需要获取全名 SomeSchema.Column1 因为现在代码似乎抛出了未找到 Column1 的 Sql 异常。我假设如果我可以将其引用为 SomeSchema.Column1 这将纠正异常。我可以使用 DataTableDataColumn 获取此信息,还是需要采取其他方法来实现此目的?有什么想法吗?我用“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云醉月微眠 2024-09-18 04:28:22

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文