error: System.Data.SqlClient.SqlException: Could not find stored procedure 'spLoadPost'.
error line : reader = cmd.ExecuteReader
code:
public Class _Default Inherits System.Web.UI.Page Dim SqlConnection As String = ConfigurationManager.ConnectionStrings("LKCSqlConnection").ConnectionString Dim checkflag As String Dim Attachment As String Dim Img As String Dim StringImg As String Dim link As String Dim VideoDBCount As String Dim Vidname1, Vidname2, Vidname3, Vidname4, Vidname5 As String
#Region "Tips&Tricks" Public Sub TipsAndTrick() Using con As New SqlConnection(SqlConnection) Using cmd As New SqlCommand cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "spLoadPost" cmd.Parameters.Add("@Param", SqlDbType.VarChar).Value = "LoadTnT"
cmd.Connection = con con.Open()
Dim reader As SqlDataReader reader = cmd.ExecuteReader While reader.Read VideoDBCount = reader.Item("Total") Vidname1 = reader.Item("Vname") End While TotalNo = VideoDBCount Vname1 = Vidname1 LoopVideo() con.Close() con.Dispose() End Using End Using If VideoDBCount > 5 Then VideoDBCount = 5 End If End Sub
Public Sub LoopVideo() For index As Integer = 1 To VideoDBCount Using con As New SqlConnection(SqlConnection) Using cmd As New SqlCommand cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "spLoadPost" cmd.Parameters.Add("@Param", SqlDbType.VarChar).Value = "LoadVideo" cmd.Parameters.Add("@Offset", SqlDbType.Int).Value = (index - 1)
cmd.Connection = con con.Open() Using reader = cmd.ExecuteReader If reader.Read Then If (index = 1) Then Vidname1 = reader.Item("Vname") ElseIf (index = 2) Then Vidname2 = reader.Item("Vname") ElseIf (index = 3) Then Vidname3 = reader.Item("Vname") ElseIf (index = 4) Then Vidname4 = reader.Item("Vname") ElseIf (index = 5) Then Vidname5 = reader.Item("Vname") End If
End If End Using End Using End Using Next End sub