0

I am creating a mobile web app using MVC 4, I need to use a database to store details, the site then redirects to paypal, and on its return we use the paypal token to find the details in the database, this works fine on my local system, I have changed the (localdb) to .\SQLEXPRESS and that works ok, but when I put it onto my server, I get the error message "CREATE DATABASE permission denied in database 'master'"

I have sql server running, but I just cannot get it to connect.

The code generates the db with the following code

namespace PaypalTestWebApp.Models
{
    public class StudentDetail
    {
        [Key]
        public string token { get; set; }
        public string studentDetails { get; set; }
        public float depositAmount { get; set; }
    }
    public class StudentDetailsContext : DbContext
    {
        public DbSet<StudentDetail> studentDetails { get; set; }
    }
}

and then I construct using the following in the page before I redirect

    StudentDetailsContext db = new StudentDetailsContext();
    StudentDetail sdb = new StudentDetail();

        if (db.studentDetails.Find(paypal.token) == null)
        {
            log.Info("found paypal token");
            sdb.token = checkoutResponse.Token;
            sdb.studentDetails = CurrentUser.UserName;
            sdb.depositAmount = float.Parse(CurrentUser.DepositAmount.ToString());

            db.studentDetails.Add(sdb);
            db.SaveChanges();
        }

and in the return page I use the following :

    StudentDetailsContext db = new StudentDetailsContext();
    StudentDetail sdb = new StudentDetail();

    sdb = db.studentDetails.Find(token);

    CurrentUser.UserName = sdb.studentDetails;
    CurrentUser.DepositAmount = sdb.depositAmount;

this all works fine on my machine, and creates the database in sql, but not on the server

my connection string is as follows :

<add name="StudentDetailsContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=StudentDetails;Integrated Security=True;Trusted_Connection=True" providerName="System.Data.SqlClient" />

Any help would be greatly appreciated

Thanks

Prasanna_PayPal
  • 902
  • 5
  • 10
Racing57
  • 81
  • 1
  • 3
  • 15
  • ok, so it looks like the my windows auth wasn't working, so I created a SQL user, and enabled the sql and windows auth... and now it works... – Racing57 Aug 20 '13 at 13:42
  • Please write that as an answer, wait a bit, then choose it as the answer. Cheers. – tommy_o Aug 20 '13 at 17:14
  • Also, posting an actual error message that others can use to either search or help you with will benefit the community. – ps2goat Aug 21 '13 at 04:30
  • ok, so due to the fact I am not allowed to answer the question.. I have added it as a comment ok, so it looks like the my windows auth wasn't working, so I created a SQL user, and enabled the sql and windows auth... please see the link below [Cannot login after creating user in SQL Sever](http://stackoverflow.com/questions/11625899/cannot-login-after-creating-the-user-in-sql-server) – Racing57 Aug 21 '13 at 11:04

0 Answers0