📄 subject_22502.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)); <BR>m_Index.CreateInstance(__uuidof(Index));<BR>m_Table = m_Catalog->GetTables()->GetItem(_variant_t(myTableName));<BR>m_Col->Name = myFieldName;<BR>m_Col->ParentCatalog = m_Catalog; <BR>if( FieldType == TYPE_AutoIncrement)<BR>{<BR> m_Col->Type = adInteger;<BR> m_Col->Properties->Item[_T("AutoIncrement")]->Value = true;<BR> m_Table->Columns->Append(static_cast<IUnknown *>(m_Col), adInteger,0);<BR>}<BR>if (FieldType == adInteger)<BR>{<BR> m_Col->Type = adInteger;<BR> m_Col->Properties->Item[_T("Nullable")]->Value = true;<BR> m_Table->Columns->Append(static_cast<IUnknown *>(m_Col), adInteger,0);<BR>}<BR>if (FieldType == adLongVarWChar)<BR>{<BR> m_Col->Type = adLongVarWChar;<BR> m_Col->Properties->Item[_T("Nullable")]->Value = true;<BR> m_Col->Properties->Item[_T("Jet OLEDB:Allow Zero Length")]->Value = true;<BR> m_Table->Columns->Append(static_cast<IUnknown *>(m_Col), adLongVarWChar,0);<BR>}
<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 + -