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