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. Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . [modified]

Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . [modified]

Scheduled Pinned Locked Moved ASP.NET
helpcsharpdatabasevisual-studiotutorial
10 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.
  • C Offline
    C Offline
    cmaheshwari16
    wrote on last edited by
    #1

    hi All, I just wanted to know the following things if u can just help me. I made a website in Visual Studio 2008 and used the database provided by the VS [I dont know which version is this]. That website runs successfully on the machine having visual studio[As in that i just attach my database through the GUI provided by VS]. Now I want to deploy that website on a LAN. I have the database in .ldf and .mdf format. But I dont know whether it is in sql 2005 or sql 2008[as i made it through Visual Studio GUI] Now the system in which i have to deploy cannot have a licensed product. So i have to convert that database either to open source or an free version of sql server. I chose to go for SQL Server express edition that is free. Now the prolem being whether I use SQL Server 2008 or 2005 as i dont know which database was provided by the VS.[when i made that databse] But the problem being that on the system in which i have to deploy does not contain VS. Supposing it provides SQL Server 2005 express edition I permormed the following test:- Now i have installed .NET framework 3.5, MS SQL server 2005 Express Edition and the SQL Server management studio that is a GUI for handling d/b. Now when I attached that database[that i have, of which i dont have the version]. I can see the database and tbles and all the contents that was there in the d/b.[through that management studio GUI]. Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:- 1> The database that i have is in SQL server 2008 express edition or something else. 2> I have to make some changes in the connectivity[in web.config or some other location] NOTE: Also when i connected the d/b in management stuio it shows all the tables with dbo as a prefix. for eg. suppose i had a table as User_Master than its showing as dbo.User_Master. please guide me if u can. Waiting for ur reply.

    modified on Wednesday, October 6, 2010 3:23 AM

    V 1 Reply Last reply
    0
    • C cmaheshwari16

      hi All, I just wanted to know the following things if u can just help me. I made a website in Visual Studio 2008 and used the database provided by the VS [I dont know which version is this]. That website runs successfully on the machine having visual studio[As in that i just attach my database through the GUI provided by VS]. Now I want to deploy that website on a LAN. I have the database in .ldf and .mdf format. But I dont know whether it is in sql 2005 or sql 2008[as i made it through Visual Studio GUI] Now the system in which i have to deploy cannot have a licensed product. So i have to convert that database either to open source or an free version of sql server. I chose to go for SQL Server express edition that is free. Now the prolem being whether I use SQL Server 2008 or 2005 as i dont know which database was provided by the VS.[when i made that databse] But the problem being that on the system in which i have to deploy does not contain VS. Supposing it provides SQL Server 2005 express edition I permormed the following test:- Now i have installed .NET framework 3.5, MS SQL server 2005 Express Edition and the SQL Server management studio that is a GUI for handling d/b. Now when I attached that database[that i have, of which i dont have the version]. I can see the database and tbles and all the contents that was there in the d/b.[through that management studio GUI]. Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:- 1> The database that i have is in SQL server 2008 express edition or something else. 2> I have to make some changes in the connectivity[in web.config or some other location] NOTE: Also when i connected the d/b in management stuio it shows all the tables with dbo as a prefix. for eg. suppose i had a table as User_Master than its showing as dbo.User_Master. please guide me if u can. Waiting for ur reply.

      modified on Wednesday, October 6, 2010 3:23 AM

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      Let me Answer your Questions You wrote : Now I want to deploy that website on a LAN. I have the database in .ldf and .mdf format. But I dont know whether it is in sql 2005 or sql 2008[as i made it through Visual Studio GUI]

      The only way to Find out is to attach it on an SQL Instance,First try to attach it in an SQL 2005 instance, if its a SQL 2008 then it will give you an error that has something like

      "bla bla bla does not belong to ...Family ...."

      and if you are able to attach it then it means its 2005

      You wrote : Now the system in which i have to deploy cannot have a licensed product. So i have to convert that database either to open source or an free version of sql server.

      The SQL Express is good for your requirement, i dont think you need to do some conversion, as long as you have SQL Express instance installed on your machine you can just attach your files

      You wrote : But the problem being that on the system in which i have to deploy does not contain VS.

      You dont need visual Studio , you need to Install the SQL instance. That will have SQL Management studio to attach your Files

      You wrote : Now i have installed .NET framework 3.5, MS SQL server 2005 Express Edition and the SQL Server management studio that is a GUI for handling d/b. Now when I attached that database[that i have, of which i dont have the version]. I can see the database and tbles and all the contents that was there in the d/b.[through that management studio GUI].

      if you could do this then its not a 2008 mdf files, you can still confirm by "Right click on your Database and go to properties and select the "Options" and check the Version from there.

      You wrote : Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

      How do you know that you cant connect , if you cant see the error ?

      You wrote : 2> I have to make some changes in the connectivity[in web.config or some other location] what is your Question Regarding this ?

      Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.z

      C 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        Let me Answer your Questions You wrote : Now I want to deploy that website on a LAN. I have the database in .ldf and .mdf format. But I dont know whether it is in sql 2005 or sql 2008[as i made it through Visual Studio GUI]

        The only way to Find out is to attach it on an SQL Instance,First try to attach it in an SQL 2005 instance, if its a SQL 2008 then it will give you an error that has something like

        "bla bla bla does not belong to ...Family ...."

        and if you are able to attach it then it means its 2005

        You wrote : Now the system in which i have to deploy cannot have a licensed product. So i have to convert that database either to open source or an free version of sql server.

        The SQL Express is good for your requirement, i dont think you need to do some conversion, as long as you have SQL Express instance installed on your machine you can just attach your files

        You wrote : But the problem being that on the system in which i have to deploy does not contain VS.

        You dont need visual Studio , you need to Install the SQL instance. That will have SQL Management studio to attach your Files

        You wrote : Now i have installed .NET framework 3.5, MS SQL server 2005 Express Edition and the SQL Server management studio that is a GUI for handling d/b. Now when I attached that database[that i have, of which i dont have the version]. I can see the database and tbles and all the contents that was there in the d/b.[through that management studio GUI].

        if you could do this then its not a 2008 mdf files, you can still confirm by "Right click on your Database and go to properties and select the "Options" and check the Version from there.

        You wrote : Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

        How do you know that you cant connect , if you cant see the error ?

        You wrote : 2> I have to make some changes in the connectivity[in web.config or some other location] what is your Question Regarding this ?

        Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.z

        C Offline
        C Offline
        cmaheshwari16
        wrote on last edited by
        #3

        Hi vuyiswa, Thanks for giving so much time i reading this and giving the reply.

        You wrote :
        Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

        How do you know that you cant connect , if you cant see the error ?

        Because when i enter hte username and password that there in the database table User_Master[that has been converted to dbo.User_Master] , i cannot loog on to. Inspite it redirects me to the locgin page again. Also I cannot debug the prog as i dont have VS 2008. To check this whats happening , i tried one thing:- On login page [in coding,aspx.cs page], i commented the line which checks whether the username and password is valid or not [ which fetches data from the database] and simply redirected to the Homepage.aspx. It works fine. On one page [in coding,aspx.cs page], i commented the line which checks whether the session for userlogin is there or not[in login page if the user is authenticated i have saved his username in session and checked this session on everypage , if the session is not null then only user can see that page]. So now when i browse that page through IIS server the page is opening(ofcourse, it will) i enter all the data in the text fields. When i submit the button [which enters the data to the tables] it gives me that dirty yellow page. [as i said earlier i cannot debug the programme without VS or there is any way]

        You wrote :
        Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

        How do you know that you cant connect , if you cant see the error ?

        Because if it connects then there is some problem related with database, and if there is some problem with database then i have redirected it to the Error.aspx page.

        You wrote :
        2> I have to make some changes in the connectivity[in web.config or some other location]

        what is your Question Regarding this ?

        As now i am not using the default D/B provided by the VS2008 and using SQL Server 2005 express edition, so are there any changes i

        M 1 Reply Last reply
        0
        • C cmaheshwari16

          Hi vuyiswa, Thanks for giving so much time i reading this and giving the reply.

          You wrote :
          Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

          How do you know that you cant connect , if you cant see the error ?

          Because when i enter hte username and password that there in the database table User_Master[that has been converted to dbo.User_Master] , i cannot loog on to. Inspite it redirects me to the locgin page again. Also I cannot debug the prog as i dont have VS 2008. To check this whats happening , i tried one thing:- On login page [in coding,aspx.cs page], i commented the line which checks whether the username and password is valid or not [ which fetches data from the database] and simply redirected to the Homepage.aspx. It works fine. On one page [in coding,aspx.cs page], i commented the line which checks whether the session for userlogin is there or not[in login page if the user is authenticated i have saved his username in session and checked this session on everypage , if the session is not null then only user can see that page]. So now when i browse that page through IIS server the page is opening(ofcourse, it will) i enter all the data in the text fields. When i submit the button [which enters the data to the tables] it gives me that dirty yellow page. [as i said earlier i cannot debug the programme without VS or there is any way]

          You wrote :
          Now i have deployed my website on IIS also and when i browse my page i can see it on the browser but ....... I am not able to connect to the database tables as when i enter the login and password it comes to the same login page again without showing any error. Now, I cannot identify whether its due to the following reason:-

          How do you know that you cant connect , if you cant see the error ?

          Because if it connects then there is some problem related with database, and if there is some problem with database then i have redirected it to the Error.aspx page.

          You wrote :
          2> I have to make some changes in the connectivity[in web.config or some other location]

          what is your Question Regarding this ?

          As now i am not using the default D/B provided by the VS2008 and using SQL Server 2005 express edition, so are there any changes i

          M Offline
          M Offline
          Murugesan G
          wrote on last edited by
          #4

          I don't think problem with db connections.... if u think so try to install Fx SDK and debug ur code using CLR Debugger or else write a single test page with complete diagnostic.

          C 1 Reply Last reply
          0
          • M Murugesan G

            I don't think problem with db connections.... if u think so try to install Fx SDK and debug ur code using CLR Debugger or else write a single test page with complete diagnostic.

            C Offline
            C Offline
            cmaheshwari16
            wrote on last edited by
            #5

            hi Murugesan, thanks for ur response but can u just explain the points that i made in the previous quote. also there are many Fx SDK versions available like Java win SDK....which to download and install and is it free? as for rules cannot install the licensed version. What do you mean by

            write a single test page with complete diagnostic.

            Thanks.

            M 1 Reply Last reply
            0
            • C cmaheshwari16

              hi Murugesan, thanks for ur response but can u just explain the points that i made in the previous quote. also there are many Fx SDK versions available like Java win SDK....which to download and install and is it free? as for rules cannot install the licensed version. What do you mean by

              write a single test page with complete diagnostic.

              Thanks.

              M Offline
              M Offline
              Murugesan G
              wrote on last edited by
              #6

              .Net framework SDK, which is free and download it from SDK Link

              write a single test page with complete diagnostic.

              For isolating the problem write a server side page to connect database.

              C 1 Reply Last reply
              0
              • M Murugesan G

                .Net framework SDK, which is free and download it from SDK Link

                write a single test page with complete diagnostic.

                For isolating the problem write a server side page to connect database.

                C Offline
                C Offline
                cmaheshwari16
                wrote on last edited by
                #7

                hi , how to connect to the database and how to provide the GUI as I said that i dont have VS. Please cant u favour me just give me some hint for login only ... also below please find my login coding... login.aspx.cs protected void btnLogin_Click(object sender, EventArgs e) { if (Session["Admin"] != null) { if (txtPassword.Text.ToUpper.Equals(Session["Admin"])) Response.Redirect("Homepage.aspx"); } String except = null; DataValidation dv = new DataValidation(); String pass = txtPassword.Text; String password = null; password = dv.loginIn(txtUserName.Text); if (password==null) { //Session["Exception"] = except; Session["SourceFile"] = Formname; Response.Redirect("Error.aspx"); txtUserName.Text = "Exception"; } else if (password.Equals(pass)) { //txtUserName.Text = "Success"; Session["User"] = txtUserName.Text; if (Session["User"].ToString().ToUpper().Equals("ADMIN")) Session["Admin"] = "ADMIN"; Response.Redirect("Homepage.aspx"); } else { lblCheck.Text="Invalid UserName or Password"; //Response.Redirect("LogIn.aspx"); } } the DataValidation function[this is one .cs file i have maintained for data validation] public String loginIn(String userName) { String queryBuilder; { DataBaseConnection ds = new DataBaseConnection(); queryBuilder = "SELECT Password FROM User_Master WHERE UserName = @uname"; String pass = ds.loginDataBase(userName, queryBuilder); return pass; } } the DataBase connection function SqlConnection getConnection() { SqlConnection cn = null; { cn = new SqlConnection(); cn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); return cn; } } public String loginDataBase(String userName, String queryBuilder) { SqlConnection sqlcon = null; try { sqlcon = new SqlConnection(); sqlcon.ConnectionS

                M 1 Reply Last reply
                0
                • C cmaheshwari16

                  hi , how to connect to the database and how to provide the GUI as I said that i dont have VS. Please cant u favour me just give me some hint for login only ... also below please find my login coding... login.aspx.cs protected void btnLogin_Click(object sender, EventArgs e) { if (Session["Admin"] != null) { if (txtPassword.Text.ToUpper.Equals(Session["Admin"])) Response.Redirect("Homepage.aspx"); } String except = null; DataValidation dv = new DataValidation(); String pass = txtPassword.Text; String password = null; password = dv.loginIn(txtUserName.Text); if (password==null) { //Session["Exception"] = except; Session["SourceFile"] = Formname; Response.Redirect("Error.aspx"); txtUserName.Text = "Exception"; } else if (password.Equals(pass)) { //txtUserName.Text = "Success"; Session["User"] = txtUserName.Text; if (Session["User"].ToString().ToUpper().Equals("ADMIN")) Session["Admin"] = "ADMIN"; Response.Redirect("Homepage.aspx"); } else { lblCheck.Text="Invalid UserName or Password"; //Response.Redirect("LogIn.aspx"); } } the DataValidation function[this is one .cs file i have maintained for data validation] public String loginIn(String userName) { String queryBuilder; { DataBaseConnection ds = new DataBaseConnection(); queryBuilder = "SELECT Password FROM User_Master WHERE UserName = @uname"; String pass = ds.loginDataBase(userName, queryBuilder); return pass; } } the DataBase connection function SqlConnection getConnection() { SqlConnection cn = null; { cn = new SqlConnection(); cn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); return cn; } } public String loginDataBase(String userName, String queryBuilder) { SqlConnection sqlcon = null; try { sqlcon = new SqlConnection(); sqlcon.ConnectionS

                  M Offline
                  M Offline
                  Murugesan G
                  wrote on last edited by
                  #8

                  Try to throw an exception and see the message... if ur not getting any exception then simply check the database table has rows or not.

                  catch (Exception ex)
                  {
                  // except = ex.ToString();
                  throw;
                  }

                  C 1 Reply Last reply
                  0
                  • M Murugesan G

                    Try to throw an exception and see the message... if ur not getting any exception then simply check the database table has rows or not.

                    catch (Exception ex)
                    {
                    // except = ex.ToString();
                    throw;
                    }

                    C Offline
                    C Offline
                    cmaheshwari16
                    wrote on last edited by
                    #9

                    hey u deleted your mail ID , i have to mail u that code , and i have used that exception, i am redirecting to Error.aspx if any error comes. you once again give me ur mail id thanks

                    M 1 Reply Last reply
                    0
                    • C cmaheshwari16

                      hey u deleted your mail ID , i have to mail u that code , and i have used that exception, i am redirecting to Error.aspx if any error comes. you once again give me ur mail id thanks

                      M Offline
                      M Offline
                      Murugesan G
                      wrote on last edited by
                      #10

                      murugesan@rsi.ramco.com

                      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