VB的数据环境,添加链接之后,再添加一个Command,就可以用SQL生成器来生成一个SQL.ACCESS在做ADP设计查询时,也可以调用SQL生成器。在SQL2000的企业管理器中,里面也有一个SQL生成器。我发现它们的外观都相同,很可能是引用某个部件处理的。
  现在本人编写的程序中,也需调用SQL生成器,如何调用?请高手们旨教。谢谢。

解决方案 »

  1.   

    自己写SQL语句查询应该更容易些
      

  2.   

    TO:creazyfish(梳分头的鱼)
    既然有现成的可以调用,为什么还要自己来写一个生成器?而且SQL生成器很难写的呀.
      

  3.   

    楼主可参考
    VisData 示例,在VB专业版和企业版中,其源代码可以在 Samples\VisData 目录中找到
      

  4.   

    TO:viena(维也纳nn-实心木头人石欠RUKYO)
    没有用,这个东西没有调用SQL生成器.我需要的是直接调用SQL生成器.
      

  5.   


    不知楼说所说的SQL生成器是需要生成脚本还是分析SQL语法?
    说的不是很明确
      

  6.   

    楼上说的是,楼主的要求不明确,这个SQL生成器是生成SQL脚本吗?是建库,还是查询的呢?
    哪种数据库?不同的数据库SQL语法是不一样的呀。如果是建库的,SQL-DMO的DataBase对象的Script方法可以生成重建当前数据库的T-SQL命令
      

  7.   

    //在SQL2000的企业管理器中,里面也有一个SQL生成器
    有吗?我还真不知道!在哪里?怎么用?
    我只知道,可以生成建库的脚本~
      

  8.   

    TO:viena(维也纳nn-实心木头人石欠RUKYO)企业管理器->打开XX数据库->点击视图->在右边的列表,右击弹出快捷菜单,选择新建视图就是.
    这就是SQL生成器了.其实是一个图形化设计SQL指令的窗体.很常用呀..
      

  9.   

    就这个呀,
    汗,没注意,一般都是手工输入SQL的~
      

  10.   

    TO:foreasldjj(皑皑)
    不是很明白你的意思,能不能详细一点呢?
      

  11.   

    不懂呀,看来没有人做到这个吧?但是,我在VB6的工程引用中看到,有几个和SQL有关的DLL,其中一个DLL,我就知道它可以查看任何数据库里的信息(包括表的数量,列的个数,名称和其它信息等等).
    它们在引用中的名称是:Microsoft SQL XXX 8.0 ,都在MICROSOFT SQL的安装目录里面,所以小弟认定,这个SQL生成器就一定在这几个DLL中!!各位大虾,请问一下,在哪里可以找到这几个DLL的使用说明??
      

  12.   

    自己做一个如何,不是很难的.就看VISDATA的实现过程.ACCESS的查询分析器我就有做过.
      

  13.   

    500分,本版不允许发:)不是很清楚你在讲什么,但是指给你一条路。
    1、VB这样的操作肯定在调用某些DLL,只是这些dll我们不常用所以不知
    2、如果你知道需要那些dll或者不知道,你都应该去找KB
      

  14.   

    Using SQL Merge and SQL Distribution Controls in a Custom Visual Basic Application
    The programs in the replctrl folder are samples of how to include the SQL Merge and SQL Distribution controls in a custom application. This sample is located in C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Samples\sqlrepl\replctrl.To run the sample programs On the computer that will be a Publisher with a local Distributor, verify that the SQL Server Agent is running. If it is not running, start it.
    Open SQL Query Analyzer, open \Samples\sqlrepl\replctrl\instsamp.sql, and then run instsamp.sql. This SQL script configures the computer for publishing and distribution, enables the computer as a Subscriber, adds a distribution database with the name distributor, creates a transactional publication named SampleTransactionalPublication, and creates a merge publication named SampleMergePublication.
    The instsamp.sql script creates pull and push subscriptions for each publication and creates and configures a database called Northwind_replica as the subscription database. Any warnings from the script regarding tables that have been created with a maximum row size that exceeds the maximum number of bytes per row can be ignored. The computer is now configured as a Publisher with a local Distributor and enabled as a Subscriber. 
    The Northwind publication database will have two publications: SampleTransactionalPublication and SampleMergePublication. The instance of SQL Server contains a new subscription database, Northwind_replica.After the instsamp.sql script has completed successfully, in SQL Server Enterprise Manager, expand Replication Monitor, expand the Agents folder, and then click the Snapshot Agents folder. In the right pane, for each agent listed, right-click, and then click Start Agent. This starts the Snapshot Agents for each publication and creates a snapshot for each publication.
    Start Visual Basic, and then open \Samples\sqlrepl\replctrl\VB\replsamp.vbp.
    On the Project menu, click References, and then in the Available References list, verify that the following controls are selected: 
    Microsoft SQL Distribution Control 8.0
    Microsoft SQL Merge Control 8.0
    Microsoft SQL Snapshot Control 8.0
    Microsoft SQL Replication Errors 8.0 
    On the File menu, click Make ReplSamp.exe, and then save the executable to a directory. 
    Run replsamp.exe. The following options will be displayed: 
    Generate Snapshot for Transactional PublicationCreates a snapshot for the Northwind transactional publication. The snapshot activity can be monitored interactively in SQL Server Enterprise Manager using Replication Monitor and the Agents folder.Generate Snapshot for Merge PublicationCreates a snapshot for the Northwind merge publication. The snapshot activity can be monitored interactively in SQL Server Enterprise Manager using Replication Monitor and the Agents folder.Update Transactional Subscription TablesRuns the Distribution Agent and applies the snapshot and schema at the subscription database, Northwind_replica. After the SQL Replication Sample dialog box shows that the task has completed, the Northwind_replica subscription database shows the new tables. The distribution activity can be monitored interactively in SQL Server Enterprise Manager using Replication Monitor and the Agents folder.Update Merge Subscription TablesRuns the Merge Agent and applies the snapshot data and schema at the merge subscription database, Northwind_replica. After the SQL Replication Sample dialog box shows that the task has completed, the Northwind_replica subscription database shows the new tables. The merge activity can be monitored interactively in SQL Server Enterprise Manager using Replication Monitor and the Agents folder.
      

  15.   

    外接程序--》 数据库--》查询生成器 --》
    qq群8622612,再多的问题进去问好了,里面有INTEL的家伙
      

  16.   

    在数据库端建立
    CREATE VIEW dbo.VIEWqtgkhf
    AS
    SELECT dbo.zlqtgk.QiTaGuKeID AS gkid, dbo.zlqtgk.XingMing AS gkxm, 
          dbo.zlqtgk.XingBie AS gkxb, dbo.zlqtgk.ZhuZhaiDianHua AS gkzzdh, 
          dbo.zlqtgk.ShouJi AS gksj, dbo.zlqtgk.ZiXunCiShu AS gkzxcs, 
          dbo.zlqtgk.ShouCiZiXunRiQi AS gksczxrq, dbo.zlqtgk.HuiFangCiShu AS gkhfcs, 
          dbo.zlqtgk.XingQuJiBie AS gkxqjb, dbo.zlgkzt.GuKeZhuangTai AS gkzt, 
          dbo.VIEWgkhf.HuiFangRiQi AS gkhfrq
    FROM dbo.zlqtgk INNER JOIN
          dbo.zlgkzt ON 
          dbo.zlqtgk.GuKeZhuangTaiID = dbo.zlgkzt.GuKeZhuangTaiID LEFT OUTER JOIN
          dbo.VIEWgkhf ON dbo.zlqtgk.QiTaGuKeID = dbo.VIEWgkhf.QiTaGuKeID
    WHERE (dbo.zlgkzt.GuKeZhuangTai = '其他顾客')
    在VB中调用Dim adocon As ADODB.Connection
    Dim adoRec As ADODB.Recordset
    .
    .
    .
    .
    .
    .strSQL = "select * from VIEWqtgkhf" & strWhereString
    adoRec.Open strSQL, adocon, adOpenDynamic, adLockPessimistic
      

  17.   

    我是要用这个SQL生成器做一个数据库控件呀
      

  18.   

    我看过SQL 2K里面的VB例子,还是找不到这个SQL生成器的调用方法呀。HELP ME
      

  19.   

    如果安装了msdn,你可以在安装目录下面找到一个 visData ,里面就是楼主所描述的vb带的那个sql生成器,里面有全部的vb代码.楼主找找吧
      

  20.   

    网上很多这样的控件或源代码,自己搜索一下。SQL查询语句生成器(Access版) 
    SQL语句生成器 V2.0