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