locked
Search Result RRS feed

  • Question

  • User280873684 posted

    Hi all,

     I hope anybody here can help me. I’m really Stuck  :-(

    It is my first AS.NET Website

    I'm trying to create a search website and it is working. However i want to post result in to diferent website and it is not working.

    I have create search page and is working

    Then result page and I’m missing something?

    I posted a code here

     

    showjob.aspx

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="showjob.aspx.vb" Inherits="showjob" %>

     

     

     

    <%@ Register src="topcontrol.ascx" tagname="topcontrol" tagprefix="uc1" %>

    <%@ Register src="BotomControl.ascx" tagname="BotomControl" tagprefix="uc3" %>

     

    <%@ Register src="searchbar.ascx" tagname="searchbar" tagprefix="uc2" %>

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head id="Head1" runat="server">

        <title></title>

    </head>

    <body>

        <form id="form1" runat="server">

        <div>

    <link href="layout.css" rel="stylesheet" type="text/css" />

    <link href="style.css" rel="stylesheet" type="text/css" />       

          

            <uc1:topcontrol ID="topcontrol1" runat="server" />

             <uc2:searchbar ID="searchbar1" runat="server" />

        </div>

        <title></title>

        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

       

    <script src="rollover.js" type="text/javascript"></script>

     

        <div id="main">

            <div>

                <div>

                    <div>

                        <div>

                                                   <div id="content">

                                                    <div>

                                               

                                                      

                                                        <asp:Repeater ID="AC_Jobs" runat="server" DataSourceID="SqlDataSource1" >

                                                                    <ItemTemplate>

                                                                    <div><h5>

                                                                    <%#Eval("ac_title")%></h5>

                                                                    </div>

                                                                    <br><div>

                                                                  <h4> TYPE: <%#Eval("ac_job_type")%><br>

                                                                    SALARY/RATE:<%#Eval("ac_rate")%><br>

                                                                   LOCATION: <%#Eval("ac_location")%><br>

                                                                  REFERENCE: <%#Eval("ac_reference")%><br>

                                                                 DESCRIPTION: </h4><%#Eval("ac_summary")%><br>

                                                                        <div>

                                                                   

                                                                </div>

                                                                </div>

                                                                      

                                                                  

                                                                    </ItemTemplate>

                                                                    </asp:Repeater>

                                                        

                                                       

                                                       

                                                        <asp:SqlDataSource ID="SqlDataSource1" runat="server"

                                                    ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"

                                                    SelectCommand="SELECT [ac_job_id], [ac_job_type], [ac_title], [ac_rate], [ac_location], [ac_reference], [ac_summary] FROM [Account]

                                                    WHERE ac_job_id=@AC_Jobs"

                                                    Runat="server">

                                                    <SelectParameters>

                                                    <asp:QueryStringParameter

                                                    Name="AC_Jobs"

                                                    QuerystringField="job" />

                                                    </SelectParameters>

                                                </asp:SqlDataSource>

                                               

                                               

                                                     <asp:Repeater ID="SC_Jobs" runat="server" DataSourceID="SqlDataSource2" >

                                                                    <ItemTemplate>

                                                                    <div><h5>

                                                                    <%#Eval("sc_title")%></h5><br>

                                                                  <h4> TYPE: <%#Eval("sc_job_type")%><br>

                                                                    SALARY/RATE:<%#Eval("sc_rate")%><br>

                                                                   LOCATION: <%#Eval("sc_location")%><br>

                                                                  REFERENCE: <%#Eval("sc_reference")%><br>

                                                                 DESCRIPTION: </h4><%#Eval("sc_summary")%><br>

                                                                        <div>

                                                                   

                                                                </div>

                                                                </div>

                                                                

                                                                    

                                                                  

                                                                    </ItemTemplate>

                                                                    </asp:Repeater>

                                                

                                                   <asp:SqlDataSource ID="SqlDataSource2" runat="server"

                                                    ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"

                                                    SelectCommand="SELECT [sc_job_id], [sc_job_type], [sc_title], [sc_rate], [sc_location], [sc_reference], [sc_summary] FROM [Science]

                                                    WHERE sc_job_id=@SC_Jobs"

                                                    Runat="server">

                                                    <SelectParameters>

                                                    <asp:QueryStringParameter

                                                    Name="SC_Jobs"

                                                    QuerystringField="job" />

                                                    </SelectParameters>

                                                </asp:SqlDataSource>

                                       

                                                 <asp:Repeater ID="SE_Job" runat="server" DataSourceID="SqlDataSource3" >

                                                                    <ItemTemplate>

                                                                    <div><h5>

                                                                    <%#Eval("se_title")%></h5><br>

                                                                  <h4> TYPE: <%#Eval("se_job_type")%><br>

                                                                    SALARY/RATE:<%#Eval("se_rate")%><br>

                                                                   LOCATION: <%#Eval("se_location")%><br>

                                                                  REFERENCE: <%#Eval("se_reference")%><br>

                                                                 DESCRIPTION: </h4><%#Eval("se_summary")%><br>

                                                                        <div>

                                                                   

                                                                </div>

                                                                </div>

                                                                      

                                                                   

                                                                  

                                                                    </ItemTemplate>

                                                                    </asp:Repeater>

                                               

                                                   <asp:SqlDataSource ID="SqlDataSource3" runat="server"

                                                    ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"

                                                    SelectCommand="SELECT [se_job_id], [se_job_type], [se_title], [se_rate], [se_location], [se_reference], [se_summary] FROM [Services]

                                                    WHERE se_job_id=@SE_Jobs"

                                                    Runat="server">

                                                    <SelectParameters>

                                                    <asp:QueryStringParameter

                                                    Name="SE_Jobs"

                                                    QuerystringField="job" />

                                                    </SelectParameters>

                                                </asp:SqlDataSource>

                                               

                                                </div>

                                                    </div>

                                                </div>

                                            </div>

                                        </div>

                                    </div>

                                </div>

                           </div>

        <uc3:BotomControl ID="BotomControl1" runat="server" />

        </form>

    </body>

    </html>

     

    Showjob.aspx.vb

    Imports System.Data.SqlClient

     

    Partial Class showjob

        Inherits System.Web.UI.Page

        Private Function GetConnectionString() As String

            Return (System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString)

        End Function

     

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     

     

            If Not IsPostBack Then

     

            End If

     

            Dim query As String = Request.QueryString("SearchQuery").ToString()

     

            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())

     

            Dim cmd As New SqlCommand("select * from Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)

     

            cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))

     

            Dim adap As New SqlDataAdapter

     

            adap = New SqlDataAdapter(cmd)

     

            Dim ds As New Data.DataSet

     

            adap.Fill(ds)

     

            AC_Jobs.DataSource = ds

     

            AC_Jobs.DataBind()

     

        End Sub

    End Class

    Thursday, November 4, 2010 11:50 AM

All replies

  • User-987742388 posted

    can you send your error massage ???

    Sunday, November 7, 2010 7:12 PM
  • User280873684 posted

    Hi arkan this is the error message I'm geting:

    Must declare the scalar variable "@ac_title".

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@ac_title".

    Source Error:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

      <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

    Stack Trace:

    [SqlException (0x80131904): Must declare the scalar variable "@ac_title".]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2394
       System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
       System.Data.SqlClient.SqlDataReader.get_MetaData() +83
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
       System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
       System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
       System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
       showjob.Page_Load(Object sender, EventArgs e) +222
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

    <!-- [SqlException]: Must declare the scalar variable "@ac_title". at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at showjob.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.showjob_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
    Monday, November 8, 2010 4:21 AM
  • User1716267170 posted

            Dim cmd As New SqlCommand("select * from Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)

            cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))

     

    Where did you pass the value for @ac_title? You need to set it if you missed it. Also, I recommend you to check the t-sql query and ensure it's correct with LIKE. Thanks.

    Tuesday, November 9, 2010 3:02 AM
  • User280873684 posted

    I did check if sql query is working it just display information below and now I want to take this to other page.  Like statement is used to search just on one or two characters.  

    I tried to post to txt file and then display on other page but this did not work.

    so tried to get information from search form to be posted on to result page and then run a query

    and information selected in form are posted to other page but nothing was displayed then I added page loader to result page and there I have something wrong. 

     

    Tuesday, November 9, 2010 4:42 AM
  • User-987742388 posted

    you have to set your parameters value  

     Dim cmd As New SqlCommand("select * from Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)


    cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))

    cmd.Parameters.AddWithValue("@ac_title",  somevalue)

    cmd.Parameters.AddWithValue("@industry", somevalue)



    Tuesday, November 9, 2010 2:29 PM
  • User280873684 posted

    It is still not working I have no clue what is wrong now i removed

     

    AC_Jobs.DataSource = ds

    AC_Jobs.DataBind()

     

    it dont have a error now but i is not displaing anything

    Thursday, November 11, 2010 10:14 AM
  • User-987742388 posted

    recheck your query with SQL server first to view the result  with your parameters 

    and 

    can you post your new code ???

    Thursday, November 11, 2010 12:37 PM
  • User280873684 posted

    Hi arkan

    this is the code i done in page that is loding after search is triger and result page is caled searchjob.aspx

    and VB

    searchjob.aspx.vb

     

    Imports System.Data.SqlClient

    Partial Class showjob
        Inherits System.Web.UI.Page
        Private Function GetConnectionString() As String
            Return (System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString)
        End Function

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     


            If Not IsPostBack Then

            End If

            Dim query As String = Request.QueryString("SearchQuery").ToString()

            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())

            Dim cmd As New SqlCommand("select * from Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)

            cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))

            cmd.Parameters.AddWithValue("@ac_title", String.Format("%{0}%", query))

            cmd.Parameters.AddWithValue("@industry", String.Format("%{0}%", query))

            Dim adap As New SqlDataAdapter

            adap = New SqlDataAdapter(cmd)

            Dim ds As New Data.DataSet

            adap.Fill(ds)

           

        End Sub
    End Class

     

    when the search result is done it go from mian page to new page however at the top bar i have only ....../searchjob.aspx?SearchQuery=acPermanentFI

    "ac" is accout tabe

    "Permanent" is job type in this table

    "FI" is the key word

     

    the sql query it was working fine with grid wiew and repeter just after going to new page it is not dispaling

     

    thanks for any help

     

    i can give you a develpment address where i posted that page

    Friday, November 12, 2010 4:42 AM
  • User-987742388 posted

    hi dear pawial 

    i was try your code with my database and it's work fine just with some additional things 

     Private Function GetConnectionString() As String
            Return (System.Configuration.ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
        End Function
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
            End If
            Dim query As String = Request.QueryString("SearchQuery").ToString()
            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())
            Dim cmd As New SqlCommand("select * from dbo.Visitors2 WHERE (([First_name] LIKE '%' +@ac_job_type+ '%') AND ([Last_Name] LIKE '%' +@ac_title+ '%') AND ([Company] = @industry))", sqlConnection1)
            cmd.CommandType = CommandType.Text
            cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))
            cmd.Parameters.AddWithValue("@ac_title", String.Format("%{0}%", query))
            cmd.Parameters.AddWithValue("@industry", String.Format("%{0}%", query))
            Dim adap As New SqlDataAdapter
            adap = New SqlDataAdapter(cmd)
            Dim ds As New Data.DataSet
            adap.Fill(ds)
        End Sub

     Private Function GetConnectionString() As String

            Return (System.Configuration.ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)

        End Function

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            If Not IsPostBack Then

            End If

            Dim query As String = Request.QueryString("SearchQuery").ToString()

            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())

            Dim cmd As New SqlCommand("select * from dbo.Visitors WHERE (([First_name] LIKE '%' +@ac_job_type+ '%') AND ([Last_Name] LIKE '%' +@ac_title+ '%') AND ([Company] = @industry))", sqlConnection1)

            cmd.CommandType = CommandType.Text

            cmd.Parameters.AddWithValue("@ac_job_type", String.Format("%{0}%", query))

            cmd.Parameters.AddWithValue("@ac_title", String.Format("%{0}%", query))

            cmd.Parameters.AddWithValue("@industry", String.Format("%{0}%", query))

            Dim adap As New SqlDataAdapter

            adap = New SqlDataAdapter(cmd)

            Dim ds As New Data.DataSet

            adap.Fill(ds)

        End Sub


    i was just add dbo. before table name and add  cmd.CommandType = CommandType.Text

    if it stile not work with you please just check if send Query string in correct way

    Friday, November 12, 2010 3:34 PM
  • User280873684 posted

     HI i tried but it dont work you can see it on my dev site http://debug.devlinfisher.co.uk/landing.aspx

    just search "%" it should show all jobs and only finance should work.

    the last change did not help.

     

    Saturday, November 13, 2010 5:02 PM
  • User-987742388 posted

    oK you can try it with OR

    Dim cmd As New SqlCommand("select * from dbo.Visitors WHERE (([First_name] LIKE '%' +@ac_job_type+ '%') OR ([Last_Name] LIKE '%' +@ac_title+ '%') OR ([Company] = @industry))", sqlConnection1)



    Sunday, November 14, 2010 5:58 AM
  • User-987742388 posted

    sorry after i checked you sit and search with "%"

    i found 

    http://debug.devlinfisher.co.uk/searchjob.aspx?SearchQuery=ac%"%"

    SearchQuery=ac%"%"

    i think you have some error with you parameter string formate 

    here i mean

    String.Format("%{0}%", query)

    try to remove this format

            cmd.Parameters.AddWithValue("@ac_job_type",  query)

            cmd.Parameters.AddWithValue("@ac_title",  query)

            cmd.Parameters.AddWithValue("@industry",  query)

    and recheck if it pass try to correct the format that used

    Sunday, November 14, 2010 6:48 AM
  • User280873684 posted

     Hi i did change it but it is not working I get this error message

     

     

    Server Error in '/' Application.

    Runtime Error

    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

    <!-- Web.Config Configuration File -->
    
    <configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>

    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

    <!-- Web.Config Configuration File -->
    
    <configuration>
        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
        </system.web>
    </configuration>

    Monday, November 15, 2010 5:59 AM
  • User-987742388 posted

    can send your new code please ???

    Monday, November 15, 2010 9:34 AM
  • User280873684 posted

    Hi this is the code and i add another website so you can see the sql query working but the search result is on the same page <o:p></o:p>

     http://debug.devlinfisher.co.uk/accountresult.aspx<o:p></o:p>

    <o:p> </o:p>

    Check this search any job “%” or ” Fi” any permanent temporary <o:p></o:p>

    i don’t know why it won’t work when transferred on to other page

    <o:p></o:p> 

    Imports

    System.Data.SqlClient

    Partial

     

     

    Class showjobInherits System.Web.UI.PagePrivate Function GetConnectionString() As String

     

     

    Return (System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString)End Function

     

     

     

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadIf Not IsPostBack Then

     

    End If

     

     

     

     

     

    adap =

     

    adap.Fill(ds)

     

     

    End

    Dim query As String = Request.QueryString("SearchQuery").ToString()Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())Dim cmd As New SqlCommand("select * from dbo.Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)String.Format("%{0}%", query)Dim adap As New SqlDataAdapterNew SqlDataAdapter(cmd)Dim ds As New Data.DataSethEnd Sub Class

    Monday, November 15, 2010 11:48 AM
  • User-987742388 posted

    there is no queryString with your new page (SearchQuery)

     If Not IsPostBack Then

            End If
    adap =
            adap.Fill(ds)
            End
            Dim query As String = Request.QueryString("SearchQuery").ToString()
            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())
            Dim cmd As New SqlCommand("select * from dbo.Account WHERE (([ac_job_type] LIKE '%' +@ac_job_type+ '%') AND ([ac_title] LIKE '%' +@ac_title+ '%') AND ([industry] = @industry))", sqlConnection1)
            String.Format("%{0}%", query)
            Dim adap As SqlDataAdapter = New SqlDataAdapter(cmd)
            Dim ds As New Data.DataSet

    can you make it just like this and recheck please?

    -----------------------------------------------------------------------------

            Dim query As String = Request.QueryString("SearchQuery").ToString()

            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())

            Dim cmd As New SqlCommand("select * from dbo.Account WHERE (([ac_job_type] LIKE '%' +query + '%') OR ([ac_title] LIKE '%' +

    query 

    + '%') OR ([industry] = query ))", sqlConnection1)

            


         


    ----------------------------------------------------------------------------------------------

    Monday, November 15, 2010 5:42 PM
  • User280873684 posted

    where should i put that on to searchresult page or vb script search result pae  

    Tuesday, November 16, 2010 4:33 AM
  • User-987742388 posted

    replace your code with it

    that in your  search button click event



    Tuesday, November 16, 2010 5:05 AM
  • User280873684 posted

     I tired it dose not work

    is ther any chance i could emial you that ziped project as it get ing frustraiting and maby im dong somathing wrong.

    Tuesday, November 16, 2010 5:42 AM
  • User-987742388 posted

    please just view your page behind  code ???




    Tuesday, November 16, 2010 10:59 PM
  • User280873684 posted

    Hi Arkan

     

    sorry I want going to use you to do work form me but maybe you could see a problem In visual developer

    I thing the first difference is when i do the search it is :

    http://debug.devlinfisher.co.uk/searchjob.aspx?SearchQuery=ac%%

    ac%% this is in wrong format

    it probably should be ... SearchQuery=dropdownlist1=ac, dropdownlist2=%, textbox1= %

    or something like that or will it not make a difference ?

    I notice on a lot websites like that with pointing to drop down list and textbox

    Then declare those values and pass to run a query

    You saying to go and check a code at present the code for loader in VB is wrong and throwing a error message

    Wednesday, November 17, 2010 11:28 AM
  • User-987742388 posted

    Don't wary 

    ------------------------------------------------------

    so 

    what do you mean with this 

    if you mean its query string 

    it's most be like this

    ndustry= & Type= & Keyword= 

    and you can generate it just like this

    make three querystring with your url 

    like this

    string SearchQuery = "Industry=" + dropdownlist1.Text + " & " + "Type=" + dropdownlist2.Text + " & " + "Keyword=" + textbox1.Text;
            string  rr = "http://debug.devlinfisher.co.uk/searchjob.aspx?" + SearchQuery;


           http://debug.devlinfisher.co.uk/searchjob.aspx?Industry= & Type= & Keyword=

    set values for each parameter 

    then

    you can use it with your search query


    Dim Industry As String = Request.QueryString("Industry").ToString()

    Dim Type As String = Request.QueryString("Type").ToString()

    Dim Keyword As String = Request.QueryString("Keyword").ToString()


            Dim sqlConnection1 As New Data.SqlClient.SqlConnection(GetConnectionString())

            Dim cmd As New SqlCommand("select * from dbo.Account WHERE (([ac_job_type] LIKE '%' +Type+ '%') OR ([ac_title] LIKE '%' +

    Keyword + '%') OR ([industry] = Industry ))", sqlConnection1)


    Wednesday, November 17, 2010 12:16 PM
  • User280873684 posted

    Hi are you sure it is not to do with click comand as it is not taking that value to other page propely  

    Friday, November 19, 2010 4:54 AM
  • User-987742388 posted

    ya i think that

    Friday, November 19, 2010 7:28 AM