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. error:datatype mismatch

error:datatype mismatch

Scheduled Pinned Locked Moved ASP.NET
helptutorial
15 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.
  • P padmanabhan N

    mylogics wrote:

    string str = "Select * From Vendor Where(VendorID= '"+ DropDownList1.SelectedValue +"')";

    check whether VendorID is int or string, if VendorID is int then use "DropDownList1.SelectedValue" if VendorID is string then use '"DropDownList1.SelectedValue"'

    Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

    M Offline
    M Offline
    mylogics
    wrote on last edited by
    #6

    actually m using access database n the vendorID datatype is autonumber previously when the vendorID was text it was workin f9.... wat shud i do... ERROR:DATATYPE MISMATCH IN CRITERIA EXPRESSION

    P A 2 Replies Last reply
    0
    • M mylogics

      actually m using access database n the vendorID datatype is autonumber previously when the vendorID was text it was workin f9.... wat shud i do... ERROR:DATATYPE MISMATCH IN CRITERIA EXPRESSION

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #7

      then remove single quotes and try

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      M 1 Reply Last reply
      0
      • M mylogics

        actually m using access database n the vendorID datatype is autonumber previously when the vendorID was text it was workin f9.... wat shud i do... ERROR:DATATYPE MISMATCH IN CRITERIA EXPRESSION

        A Offline
        A Offline
        Arindam Sinha
        wrote on last edited by
        #8

        You can try this - string str = "Select * From Vendor Where(VendorID= "+ DropDownList1.SelectedValue +")";

        Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this answer.

        1 Reply Last reply
        0
        • P padmanabhan N

          then remove single quotes and try

          Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

          M Offline
          M Offline
          mylogics
          wrote on last edited by
          #9

          it gives error while compiling.i think the problem is with dtatype of vendorID.previously when datatype was text it worked f9.

          P 1 Reply Last reply
          0
          • M mylogics

            it gives error while compiling.i think the problem is with dtatype of vendorID.previously when datatype was text it worked f9.

            P Offline
            P Offline
            padmanabhan N
            wrote on last edited by
            #10

            what is the error... what is the value you got in the dropdown selected value....

            Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

            M 1 Reply Last reply
            0
            • P padmanabhan N

              what is the error... what is the value you got in the dropdown selected value....

              Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

              M Offline
              M Offline
              mylogics
              wrote on last edited by
              #11

              hii finally it worked when i removed single quotes.wat is the logic behind this....

              P 1 Reply Last reply
              0
              • M mylogics

                hii finally it worked when i removed single quotes.wat is the logic behind this....

                P Offline
                P Offline
                padmanabhan N
                wrote on last edited by
                #12

                it will render in back end as, select * from table where id is '2'-- this is wrong because ''is for string...... so we have to mention as, select * from table where id is 2 and for name field, select name from table where name = 'xyz'-- this is correct

                Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

                M 1 Reply Last reply
                0
                • P padmanabhan N

                  it will render in back end as, select * from table where id is '2'-- this is wrong because ''is for string...... so we have to mention as, select * from table where id is 2 and for name field, select name from table where name = 'xyz'-- this is correct

                  Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

                  M Offline
                  M Offline
                  mylogics
                  wrote on last edited by
                  #13

                  ok sir thnks i got u.... :)

                  A 1 Reply Last reply
                  0
                  • M mylogics

                    ok sir thnks i got u.... :)

                    A Offline
                    A Offline
                    Arindam Sinha
                    wrote on last edited by
                    #14

                    One small suggestion..The when you build a query string try to execute that in the DB first. With quotes query would have given you the error in DB itself.

                    Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this answer.

                    M 1 Reply Last reply
                    0
                    • A Arindam Sinha

                      One small suggestion..The when you build a query string try to execute that in the DB first. With quotes query would have given you the error in DB itself.

                      Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this answer.

                      M Offline
                      M Offline
                      mylogics
                      wrote on last edited by
                      #15

                      ok thnks... ;)

                      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