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. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved Visual Basic
3 Posts 2 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

    [Message Deleted]

    D 2 Replies Last reply
    0
    • C campbells

      [Message Deleted]

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

      campbells wrote:

      Dim dbb As Database

      There is no type called "Database", unless you define it somewhere. The error means that you haven't defined it anywhere.

      campbells wrote:

      'Check to see if sp exists and delete it if it does. strSQL = "if exists " strSQL = strSQL & "SELECT dep.[name],dep.deptcode,dep.deptdesc,dep.depttotal, (dep.DeptTotal / " strSQL = strSQL & "(SELECT SUM(ti.totalsales)" strSQL = strSQL & "FROM tot_item ti)) * 100 AS PercentOfSales" strSQL = strSQL & "FROM (SELECT v.[name],d.deptcode,d.deptdesc, SUM(ti.totalsales) AS DeptTotal" strSQL = strSQL & "FROM item i ,vendor v,tot_item ti INNER JOIN dept d ON" strSQL = strSQL & "(ti.deptcode=d.deptcode) where ti.itemcode=i.itemcode and v.vendorid=i.vendorid and v.name<=@vvfrom" strSQL = strSQL & "group by v.[name],d.deptcode,d.deptdesc) AS dep" strSQL = strSQL & "ORDER BY dep.[name] ASC" strSQL = strSQL & "DROP PROCEDURE dbo.sp_ReturnParams"

      You do know that you can store this stuff in the database as a Stored Procedure, then just call the procedure from your code, right?

      Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      • C campbells

        [Message Deleted]

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3
        Dim oConnection As SqlConnection
        Dim oCommand As SqlCommand
        

        oCommand.Connection = oConnection
        ' Name of stored procedure you want to call...
        oCommand.CommandText = "GetSystemParameter"
        oCommand.CommandType = CommandType.StoredProcedure
         
        Dim sqlParam As New SqlParameter("@ParmName", SqlDbType.NVarChar, 25)
        sqlParam.Direction = ParameterDirection.Input
        sqlParam.Value = sParamName
        oCommand.Parameters.Add(sqlParam)
         
        oConnection.Open()
        oCommand.ExecuteNonQuery()
        oConnection.Close()

        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