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. data adpter

data adpter

Scheduled Pinned Locked Moved ASP.NET
question
10 Posts 4 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.
  • H Offline
    H Offline
    h ma
    wrote on last edited by
    #1

    i m creating a data adapter but is not working..is it the correct way?? OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); da.Fill(ds, "table name");

    $h@ma!|@

    S N 2 Replies Last reply
    0
    • H h ma

      i m creating a data adapter but is not working..is it the correct way?? OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); da.Fill(ds, "table name");

      $h@ma!|@

      S Offline
      S Offline
      Sonia Gupta
      wrote on last edited by
      #2

      yes it should be right. what's the error?

      H M 2 Replies Last reply
      0
      • S Sonia Gupta

        yes it should be right. what's the error?

        H Offline
        H Offline
        h ma
        wrote on last edited by
        #3

        Error 1 The best overloaded method match for 'System.Data.OleDb.OleDbDataAdapter.OleDbDataAdapter(string, string)' has some invalid arguments Error 2 Argument '2': cannot convert from 'System.Data.SqlClient.SqlConnection' to 'string'

        $h@ma!|@

        S 1 Reply Last reply
        0
        • H h ma

          Error 1 The best overloaded method match for 'System.Data.OleDb.OleDbDataAdapter.OleDbDataAdapter(string, string)' has some invalid arguments Error 2 Argument '2': cannot convert from 'System.Data.SqlClient.SqlConnection' to 'string'

          $h@ma!|@

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          if u provide ur data binding function.it wil be easy to rectify it.

          H 1 Reply Last reply
          0
          • S Sonia Gupta

            if u provide ur data binding function.it wil be easy to rectify it.

            H Offline
            H Offline
            h ma
            wrote on last edited by
            #5

            OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds.DefaultViewManager;

            $h@ma!|@

            S 1 Reply Last reply
            0
            • S Sonia Gupta

              yes it should be right. what's the error?

              M Offline
              M Offline
              mohantfor net
              wrote on last edited by
              #6

              u shd decleare the namespace System.Data.OleDb.OleDbConnection

              1 Reply Last reply
              0
              • H h ma

                OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds.DefaultViewManager;

                $h@ma!|@

                S Offline
                S Offline
                Sonia Gupta
                wrote on last edited by
                #7

                try this one OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds; searchgrid.databind();

                N 1 Reply Last reply
                0
                • H h ma

                  i m creating a data adapter but is not working..is it the correct way?? OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); da.Fill(ds, "table name");

                  $h@ma!|@

                  N Offline
                  N Offline
                  N a v a n e e t h
                  wrote on last edited by
                  #8

                  $h@ma!|@ wrote:

                  OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);

                  What is the type of conn ? OledbDataAdapter is having 4 overloaded methods. 1. public OleDbDataAdapter ( System.String selectCommandText , System.Data.OleDb.OleDbConnection selectConnection ) In this you need to pass the select query and OledbConnection object as parameters 2. public OleDbDataAdapter ( System.String selectCommandText , System.String selectConnectionString ) In this pass Query and connection string 3. public OleDbDataAdapter ( System.Data.OleDb.OleDbCommand selectCommand ) This accepts OledbCommand object and last one is with no parameters. Check your call matches with these methods ?


                  My Website | Ask smart questions

                  H 1 Reply Last reply
                  0
                  • S Sonia Gupta

                    try this one OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds; searchgrid.databind();

                    N Offline
                    N Offline
                    N a v a n e e t h
                    wrote on last edited by
                    #9

                    Sonia Gupta wrote:

                    conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name");

                    Is it possible to fill DS when connection is closed ?


                    My Website | Ask smart questions

                    1 Reply Last reply
                    0
                    • N N a v a n e e t h

                      $h@ma!|@ wrote:

                      OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);

                      What is the type of conn ? OledbDataAdapter is having 4 overloaded methods. 1. public OleDbDataAdapter ( System.String selectCommandText , System.Data.OleDb.OleDbConnection selectConnection ) In this you need to pass the select query and OledbConnection object as parameters 2. public OleDbDataAdapter ( System.String selectCommandText , System.String selectConnectionString ) In this pass Query and connection string 3. public OleDbDataAdapter ( System.Data.OleDb.OleDbCommand selectCommand ) This accepts OledbCommand object and last one is with no parameters. Check your call matches with these methods ?


                      My Website | Ask smart questions

                      H Offline
                      H Offline
                      h ma
                      wrote on last edited by
                      #10

                      ok fine i'll try thx

                      $h@ma!|@

                      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