.NET Compact Framework在windows ce 5.0上直接访问桌面版的SQL Server 2005
来源:互联网 发布:复杂网络引论 编辑:程序博客网 时间:2024/05/10 16:07
<!-- /* Font Definitions */ @font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"Cambria Math";panose-1:2 4 5 3 5 4 6 3 2 4;mso-font-charset:1;mso-generic-font-family:roman;mso-font-format:other;mso-font-pitch:variable;mso-font-signature:0 0 0 0 0 0;}@font-face{font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;mso-font-charset:0;mso-generic-font-family:swiss;mso-font-pitch:variable;mso-font-signature:-1610611985 1073750139 0 0 159 0;}@font-face{font-family:新宋体;panose-1:2 1 6 9 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@新宋体";panose-1:2 1 6 9 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:modern;mso-font-pitch:fixed;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-unhide:no;mso-style-qformat:yes;mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;mso-font-kerning:1.0pt;}a:link, span.MsoHyperlink{mso-style-priority:99;color:blue;mso-themecolor:hyperlink;text-decoration:underline;text-underline:single;}a:visited, span.MsoHyperlinkFollowed{mso-style-noshow:yes;mso-style-priority:99;color:purple;mso-themecolor:followedhyperlink;text-decoration:underline;text-underline:single;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph{mso-style-priority:34;mso-style-unhide:no;mso-style-qformat:yes;margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;text-indent:21.0pt;mso-char-indent-count:2.0;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;mso-font-kerning:1.0pt;}.MsoChpDefault{mso-style-type:export-only;mso-default-props:yes;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:595.3pt 841.9pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:42.55pt;mso-footer-margin:49.6pt;mso-paper-source:0;layout-grid:15.6pt;}div.Section1{page:Section1;} /* List Definitions */ @list l0{mso-list-id:2127966426;mso-list-type:hybrid;mso-list-template-ids:-1625365852 888459414 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}@list l0:level1{mso-level-text:%1、;mso-level-tab-stop:none;mso-level-number-position:left;margin-left:18.0pt;text-indent:-18.0pt;}ol{margin-bottom:0cm;}ul{margin-bottom:0cm;}-->
.NET Compact Framework在windows ce5.0上直接访问桌面版的SQL Server 2005
参照http://blog.csdn.net/upto/archive/2007/09/23/1797126.aspx的提示和外国朋友的劳动成果。本人英文不好不能翻译只能将自己理解总结如下:
环境:
SQL Server 2005 + SQL Server Compcat 3.5SP1 XP SP3 Virsual Studio 2008
1、 配置SQL Server2005远程连接
开始->所有程序->Microsoft SQL Server 2005->配置工具->SQL Server外围应用配置器 或者
Click On Start | All Programs | MicrosoftSQL Server2005 | Configuration Tools | SQL Server Surface Area configuration
点击“服务和连接的外围应用配置器” 或 Surface Area Configuration for Services and Connections”
按照上面的选项:选择远程连接->选择本地连接和远程连接->选中同时使用TCP/IP和named pipes(B)
点击“应用”或者确定即可。重新启动服务。
2、 配置防火墙
开始->控制面板->安全中心->Windows 防火墙
点击“添加程序”,选择C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Binn/sqlservr.exe选择确定
3、 编写程序
myConn = newSqlConnection(@"Server=192.168.1.189;Database=C_Gather;User Id=csqlce; Password=CAOchangHONG12345^&*()");
myConn.Open();
SqlDataReadermyDataReader;
SqlCommandmyCmd = myConn.CreateCommand();
myCmd.CommandText = @"SELECT TABLE_SCHEMA, TABLE_NAME FROMINFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'";
treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Tables"));
TreeNodechildNode = treeView1.Nodes[0];
intchildCount = 0;
myDataReader =myCmd.ExecuteReader();
while(myDataReader.Read())
{
stringTableName = (myDataReader[0].ToString()) + "."+ (myDataReader[1].ToString());
childNode.Nodes.Insert(childCount, new TreeNode(TableName));
childCount += 1;
}
myDataReader.Close();
treeView1.Nodes.Add(new TreeNode("Views"));
SqlCommandmyCmdView = myConn.CreateCommand();
myCmdView.CommandText = @"SELECT TABLE_SCHEMA, TABLE_NAME FROMINFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'VIEW'";
TreeNodechildNodeView = treeView1.Nodes[1];
intchildCountView = 0;
myDataReader =myCmdView.ExecuteReader();
while(myDataReader.Read())
{
stringViewName = (myDataReader[0].ToString()) + "."+ (myDataReader[1].ToString());
childNodeView.Nodes.Insert(childCount,new TreeNode(ViewName));
childCountView += 1;
}
myDataReader.Close();
treeView1.ExpandAll();
treeView1.EndUpdate();
myConn.Close();
} // try
catch(SqlException myexception)
{
foreach(SqlError err inmyexception.Errors)
{
MessageBox.Show(err.Message);
}
}
类似上面的代码,你可以到http://www.opennetcf.com/downloads/download.aspx?s=SSMS_Device下载他的完整代码
运行以后在myConn.Open();可能出现错误与他dbnetlib.dll有关的错误。你将 C:/ProgramFiles/Microsoft SQL Server Compact Edition/v3.5/Devices/Client/wce500/x86文件夹下两个文件
sql.dev.CHS.wce5.x86.CAB和sql.wce5.x86.CAB拷贝到目标设备上安装重新运行即可。
- .NET Compact Framework在windows ce 5.0上直接访问桌面版的SQL Server 2005
- SQL Server CE Database Development with the .NET Compact Framework
- 用 SQL Server CE 2.0 和 .NET Compact Framework 创建紧凑且可靠的移动应用程序
- 用 SQL Server CE 2.0 和.NET Compact Framework 开发紧凑而功能强大的移动应用程序
- .NET Compact Framework下SQL CE的使用
- .NET Compact Framework下SQL CE兼容性问题
- 如何在使用windows mobile设备上部署新版本的.net compact framework
- windows ce下Win32,MFC和.NET Compact FrameWork的对比
- 在Windows Mobile和Wince(Windows Embedded CE)下使用.NET Compact Framework进行GPS NMEA data数据分析的开发
- 在Windows Mobile和Wince(Windows Embedded CE)下如何使用.NET Compact Framework开发进程管理程序
- 在 .NET Framework Data Provider for Microsoft SQL Server Compact 3.5 中发生错误
- 在Windows Server 2003 上配置SQL Server 2005 Analysis Services 的 HTTP 访问
- SQL Server 2008 在Windows Server 2008上的访问配置 Windows 防火墙
- Microsoft .NET Compact Framework 上的高级 P/Invoke
- 原创翻译 用gSOAP在Windows Embedded Compact (Windows CE)上架构webservice
- 在Windows Server 2008下直接安装SQL Server 2008时,会出现如下错误: 必须使用“角色管理工具”安装或配置Microsoft .NET Framework 3.5 SP1
- 在设备上安装和部署 SQL Server Compact Edition
- Microsoft .NET Compact Framework 数据访问策略
- JS控制时间输入自动切换
- 使用memcpy()出现的问题
- 网络编程学习小结
- "The rowset is not bookmarkable"出错
- Datagrid不能更新
- .NET Compact Framework在windows ce 5.0上直接访问桌面版的SQL Server 2005
- C++ 引用类型
- 获取服务器的Url
- 用Jsp-taglib来实现分页功能
- 关于网易163企业邮箱的客户端设置
- .net中时间相加,60进制
- Java平台应用开发开源软件一览
- 只能输入数字和小数点!
- 手机软件之儿童识字项目实践