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. General Programming
  3. C#
  4. connect db to crystal report

connect db to crystal report

Scheduled Pinned Locked Moved C#
databasecsharpsql-servercomsysadmin
5 Posts 2 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.
  • A Offline
    A Offline
    amilapradeep
    wrote on last edited by
    #1

    i,m using c#2005 and sqlexpress. in my projects i use separate class for db connection and call that on project. there i use connection string as ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database\\stock.mdf;Integrated Security=True;User Instance=True"; as i understand this db created on project location and it attached to sql server when project(or build exe) running. after successfully build project i could see db had attached to server as "D:\Equipmanager\Equipmanager\bin\Debug\Database\stock.mdf" everything ok.db connection works fine. but problem comes when i start reports. there i tried on ADO.net and OLE DB.but wizard shows only default dbs.master etc....(actually my project db attached to server when running.show how it show there?) here's my problem... 1. can i use this connection string...is there any problem... 2. how to use project db for reporting(use crystal report)..?should i attached db manually and do report? if i use sql 2000 this problem ok.because there every db is attached and not separate file. currently i get db details by code and pass those to report(actually this connection string fine.because when deploying db is automatically attached.no need to do it manually) but passing parameter is not good when long report.that's why i want to find way connect db to report?

    T 1 Reply Last reply
    0
    • A amilapradeep

      i,m using c#2005 and sqlexpress. in my projects i use separate class for db connection and call that on project. there i use connection string as ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database\\stock.mdf;Integrated Security=True;User Instance=True"; as i understand this db created on project location and it attached to sql server when project(or build exe) running. after successfully build project i could see db had attached to server as "D:\Equipmanager\Equipmanager\bin\Debug\Database\stock.mdf" everything ok.db connection works fine. but problem comes when i start reports. there i tried on ADO.net and OLE DB.but wizard shows only default dbs.master etc....(actually my project db attached to server when running.show how it show there?) here's my problem... 1. can i use this connection string...is there any problem... 2. how to use project db for reporting(use crystal report)..?should i attached db manually and do report? if i use sql 2000 this problem ok.because there every db is attached and not separate file. currently i get db details by code and pass those to report(actually this connection string fine.because when deploying db is automatically attached.no need to do it manually) but passing parameter is not good when long report.that's why i want to find way connect db to report?

      T Offline
      T Offline
      Tyler45
      wrote on last edited by
      #2

      did you try copy your mdf file to near of other standard mdf file, maybe it can checks constant path

      A 1 Reply Last reply
      0
      • T Tyler45

        did you try copy your mdf file to near of other standard mdf file, maybe it can checks constant path

        A Offline
        A Offline
        amilapradeep
        wrote on last edited by
        #3

        sorry i can't get what you'r saying.could you please explain

        T 1 Reply Last reply
        0
        • A amilapradeep

          sorry i can't get what you'r saying.could you please explain

          T Offline
          T Offline
          Tyler45
          wrote on last edited by
          #4

          Sorry for late reply, you have said that your mdf file is on D:\Equipmanager\Equipmanager\bin\Debug\Database\stock.mdf, right. but if you use wizard you said that you can see default database(like master), and i suggest you copy stock.mdf to master.mdf's folder I wish to it is ok for you

          A 1 Reply Last reply
          0
          • T Tyler45

            Sorry for late reply, you have said that your mdf file is on D:\Equipmanager\Equipmanager\bin\Debug\Database\stock.mdf, right. but if you use wizard you said that you can see default database(like master), and i suggest you copy stock.mdf to master.mdf's folder I wish to it is ok for you

            A Offline
            A Offline
            amilapradeep
            wrote on last edited by
            #5

            thx. but that's not working.. now i use this way create dataset and populate it using database table and write xmlschema from dataset then use xml file as database file of report.it works fine

            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