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. Database & SysAdmin
  3. Database
  4. Database Connection problem in sql server 2005

Database Connection problem in sql server 2005

Scheduled Pinned Locked Moved Database
csharpdatabasehelpsql-server
2 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.
  • H Offline
    H Offline
    hbk_leo
    wrote on last edited by
    #1

    Hi to all I have a problem with database in vb.net using sqlexpress. My problem is: I have created a .mdf database file and tables in it, and written code for inserting data to this table through command object. But my real prob is when i supply the connection string which is created by the "data configuration wizard" to this cmd object then on runtime insert executes and also data is visible in datagridview but when i check the data in the table it is not there and all fields are NULL. given connection string. ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LIB.mdf;Integrated Security=True;User Instance=True") But on the otherhand if i give connection string as :: "Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\LIB\LIB\LIB.mdf;Integrated Security=True;User Instance=True" then data is successfully inserted in the database and i m also able to view it in my database table. So if Any one can help me it will be highly appreciable. Thanks.

    A 1 Reply Last reply
    0
    • H hbk_leo

      Hi to all I have a problem with database in vb.net using sqlexpress. My problem is: I have created a .mdf database file and tables in it, and written code for inserting data to this table through command object. But my real prob is when i supply the connection string which is created by the "data configuration wizard" to this cmd object then on runtime insert executes and also data is visible in datagridview but when i check the data in the table it is not there and all fields are NULL. given connection string. ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LIB.mdf;Integrated Security=True;User Instance=True") But on the otherhand if i give connection string as :: "Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\LIB\LIB\LIB.mdf;Integrated Security=True;User Instance=True" then data is successfully inserted in the database and i m also able to view it in my database table. So if Any one can help me it will be highly appreciable. Thanks.

      A Offline
      A Offline
      Ahmed Charfeddine
      wrote on last edited by
      #2

      Is'nt this a problem of relative Vs global paths ? I give you an example I know: if you call GetCurrentDir within a code that you execute through Debug-->Start Without Debugging command then you'll have something different as when you go to the Debug directory of your executable and run it from there. Thus this may lead to different behaviours as when we have relative entries, such that things will work fine, in one case, and fail in the other. Ahmed. Tunisia.

      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