Click here to Skip to main content
15,895,667 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Mail going to Queue folder in the server Pin
Abhijit Jana3-Feb-10 19:52
professionalAbhijit Jana3-Feb-10 19:52 
Questionrunning website (asp.net) on 3rd party server. Pin
jeshra2793-Feb-10 0:44
jeshra2793-Feb-10 0:44 
AnswerRe: running website (asp.net) on 3rd party server. Pin
sashidhar3-Feb-10 1:08
sashidhar3-Feb-10 1:08 
QuestionPage Loading with two update panels Pin
Hema Bairavan3-Feb-10 0:40
Hema Bairavan3-Feb-10 0:40 
AnswerRe: Page Loading with two update panels Pin
Pranay Rana3-Feb-10 0:43
professionalPranay Rana3-Feb-10 0:43 
QuestionRe: Page Loading with two update panels Pin
Hema Bairavan3-Feb-10 1:13
Hema Bairavan3-Feb-10 1:13 
AnswerRe: Page Loading with two update panels Pin
Pranay Rana3-Feb-10 1:17
professionalPranay Rana3-Feb-10 1:17 
QuestionSQL Server Express doesn't work Pin
hezi3-Feb-10 0:26
hezi3-Feb-10 0:26 
I try to open the SQL Server Express database file "sample.mdf" but it doesn't work.

Here is the code:

--------------------------------------------------------------------------



using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.OleDb;

using System.Data.SqlClient;



public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

//OleDb-ACCESS

//--------------

//OleDbConnection con = new OleDbConnection();

//string comPath = Server.MapPath("~" + @"\") + @"app_Data\webTest.mdb";

//string coS = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + comPath;





//SqlClient-SQL server express

//------------------------------

System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();

string comPath = Server.MapPath("~" + @"\") + @"app_Data\sample.mdf";

string coS = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + comPath + ";Integrated Security=True;User Instance=False;";



//OleDb-SQL server express

//-------------------------

//OleDbConnection con = new OleDbConnection();

//string comPath = Server.MapPath("~" + @"\") + @"app_Data\sample.mdf";

//string coS = "Provider=SQLOLEDB.1;" + "Data Source=" + comPath;





con.ConnectionString = coS;

con.Open();



}

}

--------------------------------------------------------------------------

1. Code OleDb-ACCESS (commented) works OK.

2 . When I run the code in section: SqlClient-SQL Server express, I get error:

Server Error in '/myWeb/trySqlServer' Application.


--------------------------------------------------------------------------

CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\MyPrograms\web\trySqlServer\app_Data\sample.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\MyPrograms\web\trySqlServer\app_Data\sample.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
---------------------------------------------------------------------------

3. When I run the code in section: OleDB-Sql server express I get error:


----------------------------------------------------------------------------
Invalid authorization specification

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Invalid authorization specification

---------------------------------------------------------------------------------------


What should I do to open the SQL Server database "sample.mdf"?



Thank you

Hezi
AnswerRe: SQL Server Express doesn't work Pin
Alaric Dailey10-Feb-10 3:06
Alaric Dailey10-Feb-10 3:06 
GeneralRe: SQL Server Express doesn't work Pin
hezi14-Feb-10 1:41
hezi14-Feb-10 1:41 
GeneralRe: SQL Server Express doesn't work Pin
Alaric Dailey14-Feb-10 4:12
Alaric Dailey14-Feb-10 4:12 
Questionwant to avoid losing data of previous screen Pin
anilaabc3-Feb-10 0:15
anilaabc3-Feb-10 0:15 
AnswerRe: want to avoid losing data of previous screen Pin
m@dhu3-Feb-10 1:37
m@dhu3-Feb-10 1:37 
AnswerRe: want to avoid losing data of previous screen Pin
Palash Biswas3-Feb-10 17:11
Palash Biswas3-Feb-10 17:11 
AnswerRe: want to avoid losing data of previous screen Pin
ScottM13-Feb-10 21:49
ScottM13-Feb-10 21:49 
QuestionIE refresh message Pin
Subin Mavunkal2-Feb-10 22:48
Subin Mavunkal2-Feb-10 22:48 
AnswerRe: IE refresh message Pin
Dinesh Mani2-Feb-10 23:17
Dinesh Mani2-Feb-10 23:17 
Questionhow to update parent window automatically ?? Pin
JC.KaNNaN2-Feb-10 22:16
JC.KaNNaN2-Feb-10 22:16 
AnswerRe: how to update parent window automatically ?? Pin
Dinesh Mani2-Feb-10 23:21
Dinesh Mani2-Feb-10 23:21 
AnswerRe: how to update parent window automatically ?? Pin
Palash Biswas3-Feb-10 17:06
Palash Biswas3-Feb-10 17:06 
Questionconvert aspx to pdf Pin
Subin Mavunkal2-Feb-10 20:47
Subin Mavunkal2-Feb-10 20:47 
AnswerRe: convert aspx to pdf Pin
Abhishek Sur2-Feb-10 21:00
professionalAbhishek Sur2-Feb-10 21:00 
QuestionMessage Removed Pin
2-Feb-10 20:34
kripa212-Feb-10 20:34 
AnswerRe: how to maintain viewstate? Pin
Dinesh Mani2-Feb-10 20:43
Dinesh Mani2-Feb-10 20:43 
GeneralRe: how to maintain viewstate? Pin
kripa212-Feb-10 21:16
kripa212-Feb-10 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.