Error on:user defined type not defined??- vb6 [modified]
-
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 -
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, 2006I 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
-
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
-
User Defined Type. A custom type that you create, specifying it's structure, members, and member types.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
User Defined Type. A custom type that you create, specifying it's structure, members, and member types.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
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