[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Debugging hint, please

Hello - I found the code example below of ASP.NET v1.0 form code, and have tried to convert ot to v2.0, but I'm getting the following error message:
      "Service not started"

on the line:
      "cmd.Fill(testDataSet)"

Can someone please tip me off as to what is wrong?

Thanks

Mark

***

Partial Class WebForm1
    Inherits System.Web.UI.Page
    Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strCatalog As String

        ' Catalog Name
        strCatalog = "TestCatalog"

        Dim strQuery As String
        strQuery = "Select DocTitle,Filename,Size,PATH,URL from SCOPE() where FREETEXT('" & TextBox1.Text & "')"
        ' TextBox1.Text is word that you type in the text box to query by using Index Service.
       
        Dim connString As String = "Provider=MSIDXS.1;Integrated Security .='';Data Source='" & strCatalog & "'"

        Dim cn As New System.Data.OleDb.OleDbConnection(connString)
        Dim cmd As New System.Data.OleDb.OleDbDataAdapter(strQuery, cn)
        Dim testDataSet As New Data.DataSet()

        cmd.Fill(testDataSet)

        ' Bind DataGrid to the DataSet. DataGrid is the ID for the
        ' DataGrid control in the HTML section.
        Dim source As New Data.DataView(testDataSet.Tables(0))
        DataGrid1.DataSource = source
        DataGrid1.DataBind()
    End Sub

End Class
0
mlagrange
Asked:
mlagrange
1 Solution
 
RichardCorrieCommented:

you need to add

cn.open

the best place is between the connection definition and the cmd definition; thus

        Dim cn As New System.Data.OleDb.OleDbConnection(connString)
cn.open()
        Dim cmd As New System.Data.OleDb.OleDbDataAdapter(strQuery, cn)

/Richard
0
 
mlagrangeAuthor Commented:
It just dawned on me what the problem is/was. I had not set up the Indexing Service to start with the pc startup. THAT was the "service" that was not running.

Then I realized I needed to change strCatalog to be the actual catalog name

It's working now...

Thanks for your reply

0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now