绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
C#操作 Advantage Database Server 数据库
2022-03-30 10:56:18

相关下载

http://devzone.advantagedatabase.com/dz/content.aspx?key=31

1.安装数据库:       

Advantage Database Server

2.安装数据库工具:

Advantage Data Architect

3.安装.NET数据访问组件(Advantage.Data.Provider.dll for .net 2.0或Advantage.Data.Entity.dll for 3.5以上):

Advantage .NET Data Provider

 

简单Demo:

引用 D:\Program Files (x86)\Advantage 11.10\ado.net\2.0\Advantage.Data.Provider.dll

  1. using System;
  2. using Advantage.Data.Provider;
  3. namespace ADSDemo
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. // create a connection object
  10. // AdsConnection conn = new AdsConnection("data source=c:\\data;" +
  11. //"ServerType=remote|local; TableType=ADT");
  12. //AdsConnection conn = new AdsConnection();
  13. //conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
  14. //"user id = adssys; password = '' " +
  15. //"ServerType=local; TrimTrailingSpaces = true";
  16. //AdsConnection conn = new AdsConnection();
  17. //conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
  18. //"user id = adssys; " +
  19. //"ServerType=local; TrimTrailingSpaces = true"; //AdsConnection conn = new AdsConnection("Data Source=\\\\127.0.0.1:6262\\data\\Demo2.add;ServerType=REMOTE;User ID=AdsSys;Password=XXXXX;");
  20. AdsConnection conn = new AdsConnection();
  21. conn.ConnectionString = "data source=c:\\data\\Demo2.add; " +
  22. "ServerType=local; TrimTrailingSpaces = true";
  23. AdsCommand cmd;
  24. AdsDataReader reader;
  25. int iField;
  26. try
  27. {
  28. conn.Open();
  29. // create a command object
  30. cmd = conn.CreateCommand();
  31. // specify a simple SELECT statement
  32. cmd.CommandText = "select * from users";
  33. // execute the statement and create a reader
  34. reader = cmd.ExecuteReader();
  35. // dump the results of the query to the console
  36. while (reader.Read())
  37. {
  38. for (iField = ; iField < reader.FieldCount; iField++)
  39. Console.Write(reader.GetValue(iField) + " ");
  40. Console.WriteLine();
  41. }
  42. conn.Close();
  43. }
  44. catch (AdsException e)
  45. {
  46. Console.WriteLine(e.Message);
  47. }
  48. catch (System.Exception ex)
  49. {
  50. Console.WriteLine(ex.Message);
  51. }
  52. Console.ReadKey();
  53. }
  54. }
  55. }

  

分享好友

分享这个小栈给你的朋友们,一起进步吧。

Advantage Database Server
创建时间:2022-03-30 10:55:30
Advantage Database Server
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • 飘絮絮絮丶
    专家
戳我,来吐槽~