Hi,
I am using Linq To SQL. I am very beginer. I have Course and CourseType tables. CourseType table contains definations got coutse. So i am joining these two tables and returning results. In designer i drag and dropped Course and CourseType tables. Below are my vb code and stored procedure. I am getting error "The null value cannot be assigned to a member with type System.Byte which is a non-nullable value type.". Could you please help me to resolve this issue?
Dim xx = CISContext.spCIS_GetCourses(True).ToList()
GridView1.DataSource = xx
GridView1.DataBind()
USE [MyDataBase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spCIS_GetCourses]
@Active BIT
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
IF @Active IS NULL OR LEN(@Active) = 0
BEGIN
SET @Active = 1
END
SELECT
A.Name as Name,
A.Description as Description,
A.CourseNumber as CourseNumber,
A.BeginDate as BeginDate,
A.EndDate as EndDate,
A.AcademicYear as AcademicYear,
A.DurationInWeeks as DurationInWeeks,
A.Active as DurationInWeeks,
A.UpdatedByID as DurationInWeeks,
A.Objectives as DurationInWeeks,
B.CourseType as CourseType
FROM tblCourse A
INNER JOIN tblLKCourseType B
ON B.CourseTypeID = A.CourseTypeID
where A.Active = @Active
END TRY
BEGIN CATCH
END CATCH
END
|