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
  1. Home
  2. Web Development
  3. ASP.NET
  4. mysql query in asp.net

mysql query in asp.net

Scheduled Pinned Locked Moved ASP.NET
databasehelpcsharpasp-netmysql
6 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.
  • U Offline
    U Offline
    User 4637012
    wrote on last edited by
    #1

    hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga

    M S 2 Replies Last reply
    0
    • U User 4637012

      hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      dim da="2009-09-15"
      dim strQuery = string.Format("select * from nysemin where date='{0}' and ticker_symbol='acc'", da)
      Dim cmd As OdbcCommand = New OdbcCommand(strQuery, con)

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      U 1 Reply Last reply
      0
      • U User 4637012

        hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga

        S Offline
        S Offline
        sashidhar
        wrote on last edited by
        #3

        Member 4640326 wrote:

        "select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con

        Instead of tht use this

        "select * from nysemin where date='" & da & "' and ticker_symbol='acc'"

        If It Helps Click It as Answer

        U 1 Reply Last reply
        0
        • M Manas Bhardwaj

          dim da="2009-09-15"
          dim strQuery = string.Format("select * from nysemin where date='{0}' and ticker_symbol='acc'", da)
          Dim cmd As OdbcCommand = New OdbcCommand(strQuery, con)

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          U Offline
          U Offline
          User 4637012
          wrote on last edited by
          #4

          hi Manas Bhardwaj thanks for your reply. i will explain clearly i have one dropdown list in that list i have INDIA,USA,UK,UAE options are there when ever the user select particular option i need to pass that option into query and get the values from database. so i need dynamic value passing into that query.how to write for in ASP.net in java we write like Empno={33,44,55,55} String ss="Select * from emp where empno='"+Empno[i]+"' and salary="20000" "; but i am new toasp.net how it is possible. i tried like this but giveing error dim strQuery = string.Format("select * from nysemin where symbol='&Empno&' and ticker_symbol='acc'", da) have a nice day bye naag

          1 Reply Last reply
          0
          • S sashidhar

            Member 4640326 wrote:

            "select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con

            Instead of tht use this

            "select * from nysemin where date='" & da & "' and ticker_symbol='acc'"

            If It Helps Click It as Answer

            U Offline
            U Offline
            User 4637012
            wrote on last edited by
            #5

            thanks sashidhar brother its working fine bye your younger brother naag

            S 1 Reply Last reply
            0
            • U User 4637012

              thanks sashidhar brother its working fine bye your younger brother naag

              S Offline
              S Offline
              sashidhar
              wrote on last edited by
              #6

              Its Ok AnyTime

              If It Helps Click It as Answer

              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