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. cannot get the value

cannot get the value

Scheduled Pinned Locked Moved Visual Basic
securityhelpquestion
4 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.
  • Z Offline
    Z Offline
    zaimah
    wrote on last edited by
    #1

    hi... im trying to convert a code according to my list.. my list in a table are: C0014 SEJATI BRT04 BRT01 MBS01 MBSB MBS02 MBSB C0015 SEJATI when i call convertCoop(coop, portal) error "Value cannot be null.Parameter name: dataSet" what does it mean?

    Private Sub convertCoop(ByVal coop As String, ByVal portal As String)

        Dim conn1 As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA\_Latihan;Persist Security Info=True;")
        Dim comm As SqlClient.SqlDataAdapter = Nothing
        Dim ds As DataSet = Nothing
    
    
        Try
            Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal WHERE folder ='" & coop & "'"
    
            conn1.Open()
            comm = New SqlClient.SqlDataAdapter(strSQL2, conn1)
            comm.Fill(ds, "kodPortal")
    
            portal = ds.Tables(0).Rows(0).Item("portal")
    
            conn1.Close()
    
        Catch ex As Exception
    
            MsgBox(ex.Message)
    
        Finally
            If Not conn1 Is Nothing And conn1.State = ConnectionState.Open Then
              conn1.Close()
            End If
            conn1 = Nothing
            comm = Nothing
        End Try
    End Sub
    
    C R 2 Replies Last reply
    0
    • Z zaimah

      hi... im trying to convert a code according to my list.. my list in a table are: C0014 SEJATI BRT04 BRT01 MBS01 MBSB MBS02 MBSB C0015 SEJATI when i call convertCoop(coop, portal) error "Value cannot be null.Parameter name: dataSet" what does it mean?

      Private Sub convertCoop(ByVal coop As String, ByVal portal As String)

          Dim conn1 As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA\_Latihan;Persist Security Info=True;")
          Dim comm As SqlClient.SqlDataAdapter = Nothing
          Dim ds As DataSet = Nothing
      
      
          Try
              Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal WHERE folder ='" & coop & "'"
      
              conn1.Open()
              comm = New SqlClient.SqlDataAdapter(strSQL2, conn1)
              comm.Fill(ds, "kodPortal")
      
              portal = ds.Tables(0).Rows(0).Item("portal")
      
              conn1.Close()
      
          Catch ex As Exception
      
              MsgBox(ex.Message)
      
          Finally
              If Not conn1 Is Nothing And conn1.State = ConnectionState.Open Then
                conn1.Close()
              End If
              conn1 = Nothing
              comm = Nothing
          End Try
      End Sub
      
      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It means you have no idea what you're doing. At a guess, it means that the parameter cannot be null. so, try Dim ds as DataSet = new DataSet() From MSDN "[Visual Basic, C#, C++] The following example uses the SqlCommand, SqlDataAdapter and SqlConnection, to select records from a database, and populate a DataSet with the selected rows. The filled DataSet is then returned. To accomplish this, the method is passed an initialized DataSet, a connection string, and a query string that is a Transact-SQL SELECT statement." Did you bother to read the docs. The dataset needs to be initialised. You're getting an error telling you the same thing.

      Christian Graus Driven to the arms of OSX by Vista.

      Z 1 Reply Last reply
      0
      • Z zaimah

        hi... im trying to convert a code according to my list.. my list in a table are: C0014 SEJATI BRT04 BRT01 MBS01 MBSB MBS02 MBSB C0015 SEJATI when i call convertCoop(coop, portal) error "Value cannot be null.Parameter name: dataSet" what does it mean?

        Private Sub convertCoop(ByVal coop As String, ByVal portal As String)

            Dim conn1 As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA\_Latihan;Persist Security Info=True;")
            Dim comm As SqlClient.SqlDataAdapter = Nothing
            Dim ds As DataSet = Nothing
        
        
            Try
                Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal WHERE folder ='" & coop & "'"
        
                conn1.Open()
                comm = New SqlClient.SqlDataAdapter(strSQL2, conn1)
                comm.Fill(ds, "kodPortal")
        
                portal = ds.Tables(0).Rows(0).Item("portal")
        
                conn1.Close()
        
            Catch ex As Exception
        
                MsgBox(ex.Message)
        
            Finally
                If Not conn1 Is Nothing And conn1.State = ConnectionState.Open Then
                  conn1.Close()
                End If
                conn1 = Nothing
                comm = Nothing
            End Try
        End Sub
        
        R Offline
        R Offline
        Rupesh Kumar Swami
        wrote on last edited by
        #3

        zaimah wrote:

        comm.Fill(ds, "kodPortal") portal = ds.Tables(0).Rows(0).Item("portal")

        whether you check the dataset contain any row? First create a instance of dataset.

        Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11

        1 Reply Last reply
        0
        • C Christian Graus

          It means you have no idea what you're doing. At a guess, it means that the parameter cannot be null. so, try Dim ds as DataSet = new DataSet() From MSDN "[Visual Basic, C#, C++] The following example uses the SqlCommand, SqlDataAdapter and SqlConnection, to select records from a database, and populate a DataSet with the selected rows. The filled DataSet is then returned. To accomplish this, the method is passed an initialized DataSet, a connection string, and a query string that is a Transact-SQL SELECT statement." Did you bother to read the docs. The dataset needs to be initialised. You're getting an error telling you the same thing.

          Christian Graus Driven to the arms of OSX by Vista.

          Z Offline
          Z Offline
          zaimah
          wrote on last edited by
          #4

          thanks a lot.. actually im not use to programming.. and my english r not quite good.. so when i try to google to find doc related to my problem, most of it r not.. maybe bcoz i put the wrong words.. the problem solve but how i can retrieve the value from portal that is inside the function to be call in other private sub.. bcoz im calling the function inside the other private sub called SEMAK. how can i get the latest value of portal inside that sub? or can u give me link to any doc related to my question.. thank you for helping me..

          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