Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Error on:user defined type not defined??- vb6 [modified]

Error on:user defined type not defined??- vb6 [modified]

Scheduled Pinned Locked Moved Visual Basic
databasemysqlhelpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    I was trying to link my vb6 to the MYSQL but i got this Error:"user defined type not defined"?? Dim dbb As Database <-- Error Dim rs As Recordset Dim strConnect As String Dim strSQL As String Dim strResult As String 'Set connect string. strConnect = "ODBC;DSN=DSN_SP_TEST;" 'Open the database Set dbb = DBEngine.Workspaces(0).OpenDatabase("", False, False, _ strConnect) 'Create the stored procedure. It really does not do much. 'It simply sets the variables and returns strSQL = "/****** Object: Stored Procedure dbo.sp_Vendor */" strSQL = strSQL & vbCrLf & "CREATE PROCEDURE storebo.sp_vendor" strSQL = strSQL & vbCrLf & "/* Declare Parameters */" strSQL = strSQL & vbCrLf & "@param1 varchar(20) ,@param2 varchar(20) ," strSQL = strSQL & vbCrLf & "@param3 smalldatetime ,@param4 smalldatetime" strSQL = strSQL & vbCrLf & "as" strSQL = strSQL & vbCrLf & "begin" strSQL = strSQL & vbCrLf & "SELECT dep.[name],dep.deptcode,dep.deptdesc,dep.depttotal, (dep.DeptTotal / (SELECT sum(dep.depttotal)" strSQL = strSQL & vbCrLf & "FROM (SELECT v.[name],d.deptcode,d.deptdesc, SUM(ti.totalsales) AS DeptTotal" strSQL = strSQL & vbCrLf & "FROM item i ,vendor v,tot_item ti INNER JOIN dept d ON (ti.deptcode=d.deptcode) where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and v.[name]>=@param1 and v.[name]<=@param2 and ti.bizdate>=@param3 and ti.bizdate<=@param4" strSQL = strSQL & vbCrLf & "group by v.[name],d.deptcode,d.deptdesc) AS dep )) * 100 AS PercentOfSales" strSQL = strSQL & vbCrLf & "FROM (SELECT v.[name],d.deptcode,d.deptdesc, SUM(ti.totalsales) AS DeptTotal" strSQL = strSQL & vbCrLf & "FROM item i ,vendor v,tot_item ti INNER JOIN dept d ON (ti.deptcode=d.deptcode) where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and v.[name]>=@param1 and v.[name]<=@param2 and ti.bizdate>=@param3 and ti.bizdate<=@param4" strSQL = strSQL & vbCrLf & "group by v.[name],d.deptcode,d.deptdesc) AS dep" strSQL = strSQL & vbCrLf & "ORDER BY dep.[name] ASC" End MsgBox strSQL db.Execute strSQL, dbSQLPassThrough -- modified at 22:16 Tuesday 17th October, 2006

    C 1 Reply Last reply
    0
    • C campbells

      I was trying to link my vb6 to the MYSQL but i got this Error:"user defined type not defined"?? Dim dbb As Database <-- Error Dim rs As Recordset Dim strConnect As String Dim strSQL As String Dim strResult As String 'Set connect string. strConnect = "ODBC;DSN=DSN_SP_TEST;" 'Open the database Set dbb = DBEngine.Workspaces(0).OpenDatabase("", False, False, _ strConnect) 'Create the stored procedure. It really does not do much. 'It simply sets the variables and returns strSQL = "/****** Object: Stored Procedure dbo.sp_Vendor */" strSQL = strSQL & vbCrLf & "CREATE PROCEDURE storebo.sp_vendor" strSQL = strSQL & vbCrLf & "/* Declare Parameters */" strSQL = strSQL & vbCrLf & "@param1 varchar(20) ,@param2 varchar(20) ," strSQL = strSQL & vbCrLf & "@param3 smalldatetime ,@param4 smalldatetime" strSQL = strSQL & vbCrLf & "as" strSQL = strSQL & vbCrLf & "begin" strSQL = strSQL & vbCrLf & "SELECT dep.[name],dep.deptcode,dep.deptdesc,dep.depttotal, (dep.DeptTotal / (SELECT sum(dep.depttotal)" strSQL = strSQL & vbCrLf & "FROM (SELECT v.[name],d.deptcode,d.deptdesc, SUM(ti.totalsales) AS DeptTotal" strSQL = strSQL & vbCrLf & "FROM item i ,vendor v,tot_item ti INNER JOIN dept d ON (ti.deptcode=d.deptcode) where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and v.[name]>=@param1 and v.[name]<=@param2 and ti.bizdate>=@param3 and ti.bizdate<=@param4" strSQL = strSQL & vbCrLf & "group by v.[name],d.deptcode,d.deptdesc) AS dep )) * 100 AS PercentOfSales" strSQL = strSQL & vbCrLf & "FROM (SELECT v.[name],d.deptcode,d.deptdesc, SUM(ti.totalsales) AS DeptTotal" strSQL = strSQL & vbCrLf & "FROM item i ,vendor v,tot_item ti INNER JOIN dept d ON (ti.deptcode=d.deptcode) where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and v.[name]>=@param1 and v.[name]<=@param2 and ti.bizdate>=@param3 and ti.bizdate<=@param4" strSQL = strSQL & vbCrLf & "group by v.[name],d.deptcode,d.deptdesc) AS dep" strSQL = strSQL & vbCrLf & "ORDER BY dep.[name] ASC" End MsgBox strSQL db.Execute strSQL, dbSQLPassThrough -- modified at 22:16 Tuesday 17th October, 2006

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I don't see a UDT in the code you have posted ? It looks to me like you almost got to the part that matters and stopped.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      C 1 Reply Last reply
      0
      • C Christian Graus

        I don't see a UDT in the code you have posted ? It looks to me like you almost got to the part that matters and stopped.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        C Offline
        C Offline
        campbells
        wrote on last edited by
        #3

        wats UDT??

        D 1 Reply Last reply
        0
        • C campbells

          wats UDT??

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          User Defined Type. A custom type that you create, specifying it's structure, members, and member types.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          C 1 Reply Last reply
          0
          • D Dave Kreskowiak

            User Defined Type. A custom type that you create, specifying it's structure, members, and member types.

            Dave Kreskowiak Microsoft MVP - Visual Basic

            C Offline
            C Offline
            campbells
            wrote on last edited by
            #5

            what should i need to create for database?

            D 1 Reply Last reply
            0
            • C campbells

              what should i need to create for database?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              The compiler is bitching because the type "Database" doesn't exist, or at least you haven't supplied enough information to tell the compiler where to find the Database type definition. Is this an ADODB Database object? If so, you'll probably have to do something like this:

              Dim dbb As ADODB.Database
              

              DO NOT COPY AND PASTE THIS CODE INTO YOUR APP!! I have no idea if it's going to work and can't even tell you if the Database object you're looking for is even in the ADODB namespace.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups