Click here to Skip to main content
15,070,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dim set1 As New SqlCommand("dbo.Test", conn)
set1.CommandType = CommandType.StoredProcedure
set1.Parameters.AddWithValue("@Student_ID", DataSet.Tables(0).Rows(y).Item("Student_ID"))
Dim reader02 As SqlDataReader = set1.ExecuteReader()
Dim myDataSet As DataTable = New DataTable()
myDataSet.Load(reader02)


Stored Procedure
USE [student]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Test] (
   @Student_ID nvarchar 
) AS
BEGIN
   SELECT DISTINCT Student_ID, Student_Mark
   FROM student, studentMark 
   WHERE student = studentMarkID
   and Student_ID = @Student_ID
   and Student_Mark is not null
END


What I have tried:

The dataset return value null?
Posted
Updated 18-May-20 21:45pm
v5
Comments
Maciej Los 19-May-20 4:00am
   
Please, do NOT remove the content of question if there's at least one answer. In that case any existing answer is not related to the question. If you have found an answer. Please, share it and accept it as solution.

1 solution

You're not really big on describing what the error is and in what line of code it is occurring, are you ? .. you need to get better if you continue to expect more help, because people have better things to do than 'decode' what you're trying

Personally, I would remove this
Dim reader02 As SqlDataReader = set1.ExecuteReader()
Dim myDataSet As DataTable = New DataTable()
myDataSet.Load(reader02)

and go for something like
Dim sDA As New SqlDataAdapter(Set1)
Dim myDataSet = new DataSet()
Try
  sDA.Fill(myDataSet)
Catch ex As Exception
  ... do something useful here ...
End Try
   
Comments
Maciej Los 19-May-20 4:00am
   
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900