OSLAdmin
asked on
Could not find stored procedure 'False'.
using the following:
Private Sub PopulateApps()
Dim b As New BuildDetails
Dim ds As DataSet
Dim dvw As DataView
ds = b.GetBuildApp(Session("Com puterID2") )
dvw = ds.Tables(0).DefaultView()
dvw.Sort() = "AppName"
With ddlApps
.DataSource = dvw
.DataValueField = "ApplicationID"
.DataTextField = "AppName"
End With
ddlApps.DataBind()
End Sub
Function:
Friend Function GetBuildApp(ByVal ComputerID As String) As DataSet
Dim db As New DataAccess
Dim cn As New SqlConnection(db.ConnectSt r)
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication as a ON ca.ApplicationID=a.Applica tionID " & _
"Where ComputerID" = ComputerID
Dim da As New SqlDataAdapter(sSQL, cn)
Dim ds As New DataSet("App")
cn.Open()
da.Fill(ds, "App")
cn.Close()
Return ds
End Function
I get the following error:
Could not find stored procedure 'False'.
Private Sub PopulateApps()
Dim b As New BuildDetails
Dim ds As DataSet
Dim dvw As DataView
ds = b.GetBuildApp(Session("Com
dvw = ds.Tables(0).DefaultView()
dvw.Sort() = "AppName"
With ddlApps
.DataSource = dvw
.DataValueField = "ApplicationID"
.DataTextField = "AppName"
End With
ddlApps.DataBind()
End Sub
Function:
Friend Function GetBuildApp(ByVal ComputerID As String) As DataSet
Dim db As New DataAccess
Dim cn As New SqlConnection(db.ConnectSt
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication as a ON ca.ApplicationID=a.Applica
"Where ComputerID" = ComputerID
Dim da As New SqlDataAdapter(sSQL, cn)
Dim ds As New DataSet("App")
cn.Open()
da.Fill(ds, "App")
cn.Close()
Return ds
End Function
I get the following error:
Could not find stored procedure 'False'.
Change your SQL String
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication a ON ca.ApplicationID=a.Applica tionID " & _
"Where ComputerID" = ComputerID
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication a ON ca.ApplicationID=a.Applica
"Where ComputerID" = ComputerID
oops.... typo...
but x_com has done that , already...
but x_com has done that , already...
ASKER
that does not solve the problem unfortunatly
somewhere you have specified stored procedure as your command type. That is what is causing the error. Look for any text containing storedprocedure.
where does it error out at?
Ok do this...
Friend Function GetBuildApp(ByVal ComputerID As String) As DataSet
Dim db As New DataAccess
Dim cn As New SqlConnection(db.ConnectSt r)
'Change SQL String a bit
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca, tblApplication a WHERE ca.ApplicationID=a.Applica tionID " & _
"AND ComputerID=" & ComputerID
Dim da As New SqlDataAdapter(sSQL, cn)
da.SelectCommand.CommandTy pe = CommandType.Text 'Add this line
Dim ds As New DataSet("App")
cn.Open()
da.Fill(ds, "App")
cn.Close()
Return ds
End Function
Friend Function GetBuildApp(ByVal ComputerID As String) As DataSet
Dim db As New DataAccess
Dim cn As New SqlConnection(db.ConnectSt
'Change SQL String a bit
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca, tblApplication a WHERE ca.ApplicationID=a.Applica
"AND ComputerID=" & ComputerID
Dim da As New SqlDataAdapter(sSQL, cn)
da.SelectCommand.CommandTy
Dim ds As New DataSet("App")
cn.Open()
da.Fill(ds, "App")
cn.Close()
Return ds
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
look for this somewhere in your code:
cmd.CommandType = CommandType.StoredProcedur e
cmd.CommandType = CommandType.StoredProcedur
x_com first obervation is right, but you need to put single quotes around your computer id string.
Try:
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication as a ON ca.ApplicationID=a.Applica tionID " & _
"Where ComputerID = '" & ComputerID & "'"
And then if this does not work, create a command with the above sql and use it to create the adapter.
Dim cmd As New SqlCommand(sSQL)
Dim da As New SqlAdapter(cmd)
John
Try:
Dim sSQL As String = "Select ca.ComputerID, a.ApplicationID, a.AppName " & _
"From tblComputerApplication ca " & _
"INNER JOIN tblApplication as a ON ca.ApplicationID=a.Applica
"Where ComputerID = '" & ComputerID & "'"
And then if this does not work, create a command with the above sql and use it to create the adapter.
Dim cmd As New SqlCommand(sSQL)
Dim da As New SqlAdapter(cmd)
John
Oops, x_com has already seen that... if it works point go to him.
John
John
This line :
"Where ComputerID" = ComputerID
Change to
"Where ComputerID = " & ComputerID