Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. sql query

sql query

Scheduled Pinned Locked Moved Database
databasehelptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creative77
    wrote on last edited by
    #1

    "hi i have a confusion i m using this query in asp.vb page now i have Dim strsearch As String strsearch = txtsearch1.Text i want to search records form mytable with the value of strsearch. strseach is input variable for search a record form mytable please guide me about this dadsubmit = New SqlDataAdapter("SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia, Title, Description, ChooseThumbnail, ChooseTopic, Datetime, (SELECT COUNT(CommentId) AS Expr1 FROM CommentTable WHERE (CommentUrlid = Submitnewtable.Urlid)) AS cnt, DATEDIFF(day, Datetime, GETDATE()) AS diff FROM Submitnewtable WHERE

    Title like '%%' &strsearch , consumit)

    there is error in block code

    N T 2 Replies Last reply
    0
    • C creative77

      "hi i have a confusion i m using this query in asp.vb page now i have Dim strsearch As String strsearch = txtsearch1.Text i want to search records form mytable with the value of strsearch. strseach is input variable for search a record form mytable please guide me about this dadsubmit = New SqlDataAdapter("SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia, Title, Description, ChooseThumbnail, ChooseTopic, Datetime, (SELECT COUNT(CommentId) AS Expr1 FROM CommentTable WHERE (CommentUrlid = Submitnewtable.Urlid)) AS cnt, DATEDIFF(day, Datetime, GETDATE()) AS diff FROM Submitnewtable WHERE

      Title like '%%' &strsearch , consumit)

      there is error in block code

      N Offline
      N Offline
      Niladri_Biswas
      wrote on last edited by
      #2

      Hi, I don't know mush about VB.net but I think it will be

      '%' & strsearch & '%'

      :)

      Niladri Biswas

      1 Reply Last reply
      0
      • C creative77

        "hi i have a confusion i m using this query in asp.vb page now i have Dim strsearch As String strsearch = txtsearch1.Text i want to search records form mytable with the value of strsearch. strseach is input variable for search a record form mytable please guide me about this dadsubmit = New SqlDataAdapter("SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia, Title, Description, ChooseThumbnail, ChooseTopic, Datetime, (SELECT COUNT(CommentId) AS Expr1 FROM CommentTable WHERE (CommentUrlid = Submitnewtable.Urlid)) AS cnt, DATEDIFF(day, Datetime, GETDATE()) AS diff FROM Submitnewtable WHERE

        Title like '%%' &strsearch , consumit)

        there is error in block code

        T Offline
        T Offline
        The Man from U N C L E
        wrote on last edited by
        #3

        Try the following:

        dadsubmit = New SqlDataAdapter(
        String.Concat("SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia, Title, ", _
        "Description, ChooseThumbnail, ChooseTopic, Datetime, ", _
        "(SELECT COUNT(CommentId) AS Expr1 FROM CommentTable WHERE ", _
        "(CommentUrlid = Submitnewtable.Urlid)) AS cnt, ", _
        "DATEDIFF(day, Datetime, GETDATE()) AS diff ", _
        "FROM Submitnewtable WHERE Title like '%", strsearch.Trim(), "%';") _
        , consumit)

        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk

        C 1 Reply Last reply
        0
        • T The Man from U N C L E

          Try the following:

          dadsubmit = New SqlDataAdapter(
          String.Concat("SELECT AuthorId, UrlUserName, Urlid, UrlAddress, ChooseMedia, Title, ", _
          "Description, ChooseThumbnail, ChooseTopic, Datetime, ", _
          "(SELECT COUNT(CommentId) AS Expr1 FROM CommentTable WHERE ", _
          "(CommentUrlid = Submitnewtable.Urlid)) AS cnt, ", _
          "DATEDIFF(day, Datetime, GETDATE()) AS diff ", _
          "FROM Submitnewtable WHERE Title like '%", strsearch.Trim(), "%';") _
          , consumit)

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk

          C Offline
          C Offline
          creative77
          wrote on last edited by
          #4

          thanks a lot its working

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups