Bonjour a tous et passer de Bonne Fêtes NOËl.
J'utilise ceci pour creer une base de donnée mais je recoit toujours la meme reponse
Code C# :
string m_databaseFilename = "aspnetContactsDB";
string m_basePath = Server.MapPath(@"App_data\\");
if (File.Exists(Server.MapPath(@"App_data\\aspnetContactsDB.mdf")).Equals(false))
{
using (var connection = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=master;Integrated Security=true;User Instance=True;"))
{
connection.Open();
using (var command = connection.CreateCommand())
{
command.CommandText = "CREATE DATABASE " + m_databaseFilename + " ON PRIMARY (NAME=" + m_databaseFilename + ", FILENAME='" + m_basePath + m_databaseFilename + ".mdf')";
command.ExecuteNonQuery();
command.Dispose();
}
connection.Close();
connection.Dispose();
}
FindContactsTable();
return;
}
else
{
FindContactsTable();
return;
}
Base de données existe deja essayer un autre nom
et pourtant elle n'existe pas
elle a deja ete creer mais doit etre a nouveau pour un autre projet
KKUN Peut m'aider SVP
MERCI!
DanMor