⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_22502.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:22502 发表者:jxhebin 发表日期:2002-11-26 14:56:19
<br>主题:vc++中用ADO创建数据库时,如何使得字段能为sql保留字段,以及如何使字段允许空字符串
<br>内容:在vc++中用ADO创建数据库时,当字段为sql保留字时,就产生错误。后来使用ADOX能<BR>解决这个问题,但是却不知道ADOX中如何设置字段属性,包括字段允许空字符串,以及字段缺省值的设置等等。请高手帮忙给出建议<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:lasery 回复日期:2002-11-26 15:49:01
<br>内容:m_Col.CreateInstance(__uuidof(Column));&nbsp;&nbsp;&nbsp;&nbsp;<BR>m_Index.CreateInstance(__uuidof(Index));<BR>m_Table = m_Catalog-&gt;GetTables()-&gt;GetItem(_variant_t(myTableName));<BR>m_Col-&gt;Name =&nbsp;&nbsp;myFieldName;<BR>m_Col-&gt;ParentCatalog = m_Catalog; <BR>if( FieldType == TYPE_AutoIncrement)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_Col-&gt;Type = adInteger;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Properties-&gt;Item[_T("AutoIncrement")]-&gt;Value = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Table-&gt;Columns-&gt;Append(static_cast&lt;IUnknown *&gt;(m_Col), adInteger,0);<BR>}<BR>if (FieldType == adInteger)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Type = adInteger;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Properties-&gt;Item[_T("Nullable")]-&gt;Value = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Table-&gt;Columns-&gt;Append(static_cast&lt;IUnknown *&gt;(m_Col), adInteger,0);<BR>}<BR>if (FieldType == adLongVarWChar)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Type = adLongVarWChar;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Properties-&gt;Item[_T("Nullable")]-&gt;Value = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Col-&gt;Properties-&gt;Item[_T("Jet OLEDB:Allow Zero Length")]-&gt;Value = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Table-&gt;Columns-&gt;Append(static_cast&lt;IUnknown *&gt;(m_Col), adLongVarWChar,0);<BR>}&nbsp;&nbsp;&nbsp;&nbsp;
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:jxhebin 回复日期:2002-11-26 15:52:28
<br>内容:谢谢lasery
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -