Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Wednesday, March 21, 2012

Atlas Samples Database Cannot Connect

I have SQL 2005 Express and SQL 2005 Developer Edition

I installed the Atlas examples in the default location but the example websites fail.

System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.

If I try to attach to the .MDF files using Management Studio in the website app_data folder I get this:

Attach database failed for Server 'local\SQLEXPRESS'. (Microsoft.SqlServer.Smo)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Program Files\Microsoft ASP.NET\Atlas Sample Applications\TaskList\App_Data\Tasklist_log.LDF'.
Could not open new database 'C:\WEBSITES\WEBNET\MISC\ATLAS\SRC\APPS\TASKLIST\APP_DATA\TASKLIST.MDF'. CREATE DATABASE is aborted.
File activation failure. The physical file name "C:\websites\webnet\misc\atlas\src\Apps\TaskList\App_Data\Tasklist_log.ldf" may be incorrect. (Microsoft SQL Server, Error: 5123)

I don't have a c:\websites folder and there is no .ldf file shipped with these examples.

Do they test this stuff before offering them up for people to waste an entire Sunday pissing around with examples that don't work? What's going on?

hello.

it looks like you don't have enough permissions on the folder where the sql database is placed to do what you're after. maybe you should take this issue to the sql express forum (i think that you'llget a faster answer there.)


Thanks Luis,

It turns out that I had SQL Express installed from my VS 2005 installation. The version of SQL 2005 Developer I had would not install because it said the Express version was newer. So, I had to uninstall Express, install Developer Edition then re-installed Express to use the examples.

Long and short of it is, if you do that you need to delete the Documents and Settings\<user>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder so it will re-create that folder with the current install of SQLExpress. That is where it creates files related to a user instance of SQL Server that dynamically attaches .mdf files like the Atlas examples.

How stupid of me to not know that... Hmmm

Atlas Re-Orde List - DataBinding from SQL 2005

I've had no problems working with this control using DataSources declared in the .ASPX page. However, I am having a fun time trying to get this working with DataBinding from our DataBase.

Where I have gotten so far:

List Renders

List Will Re-Order perfectly

List Will Post Back only to the Page_Load event... no other event

I have the event: rlValues_ItemReorder declared and it should be going to that event, but it doesn't.

During postbacks to the server, I check to see how many items the Re-Order list has in it, and it tells me 0. I had the original DataBinding in an if(!IsPostBack) on the page load, and I've changed it so it binds on each page load. I'm not sure which one I need.

Here is the code I am working with:

Item.Fields.FieldList objFieldList;

int intFieldID = 1;

protectedvoid Page_Load(object sender,EventArgs e)

{

objFieldList =newItemManagement.Item.Fields.FieldList(base.GeneralSettings.ConnectionString, intFieldID);

BindData();

}

privatevoid BindData()

{

rlValues.DataSource = objFieldList.ListValues();

rlValues.DataBind();

}

protectedvoid rlValues_ItemReorder(object sender, AtlasControlToolkit.ReorderListItemReorderEventArgs e)

{

thrownewException("The method or operation is not implemented.");

}

protectedvoid btnInsert_Click(object sender,EventArgs e)

{

if (txtValue.Text !="" && txtText.Text !="")

{

objFieldList =new ItemManagement.Item.Fields.FieldList(base.GeneralSettings.ConnectionString, intFieldID);

objFieldList.InsertValue(txtText.Text,Int32.Parse(txtValue.Text));

BindData();

}

}


Here is the .aspx side I'm working with:

<atlas:scriptmanagerid="ScriptManager1"EnablePartialRendering="true"runat="server">

<ErrorTemplate>

<divstyle="padding: 12px; width: 400px; height: 140px; border: #000000 1px solid;

background-color: white; text-align: left">

An error has occurred:<br/>

<spanid="errorMessageLabel"runat="server"></span>

<br/>

<br/>

<inputid="okButton"runat="server"type="button"value="OK"/>

</div>

</ErrorTemplate>

</atlas:scriptmanager>

<divclass="reorderListDemo">

<atlastoolkit:reorderlistid="rlValues"runat="server"

allowreorder="true"draghandlealignment="Left"iteminsertlocation="Beginning"

datakeyfield="FieldListValueID"sortorderfield="Order"Width="90%"OnItemReorder="rlValues_ItemReorder">

<ItemTemplate>

<divclass="itemArea">

<asp:LabelID="lblText"runat="server"Text='<%# Eval("Text")%>'/> |

<asp:LabelID="lblValue"runat="server"Text='<%# Eval("Value")%>'/>

</div>

</ItemTemplate>

<ReorderTemplate>

<asp:PanelID="Panel2"runat="server"CssClass="reorderCue"> </asp:Panel>

</ReorderTemplate>

<DragHandleTemplate>

<divclass="dragHandle"> </div>

</DragHandleTemplate>

</atlastoolkit:reorderlist>

<hr/>

<asp:LabelID="lblOutput"runat="server"/>

<hr/>

Value:<asp:TextBoxID="txtValue"runat="server"/>

<br/>

Text:<asp:TextBoxID="txtText"runat="server"/>

<br/>

<asp:ButtonID="btnInsert"runat="server"Text="Insert"OnClick="btnInsert_Click"/>

</div>

Any help would be awesome.

Thanks.

I believe you need to rebind each time. Without rebinding the list thinks it has zero members, and (using the latest drop from CodePlex) throws exceptions in (as I recall) reorderList.cs ('Item index > count' or something like that). Further code there invokes the Reorder function, so if it bombs out your reorder function never gets called.

The main issue I see with my example is that It never hits the re-order event (if that is what you mean).

The Version I'm using is the newest one from CodePlex... but I have yet to see any errors from the control.


Shawn helped me with this. If I take the Order field out (seeing i'm binding with an IList) it works perect.