Showing posts with label quotan. Show all posts
Showing posts with label quotan. Show all posts

Friday, February 24, 2012

Error "An attempt to attach an auto-named database for file"

Hello,

I have seen some solutions of which I tried on this form for the error I am receiving, but I still cannot get the issue resolved.

Here is my case:

I developed an app using SQL Express as the local data source. I published it to my server using the Once Click install feature. When I look in my project viewer, under settings, My db connection strings are listed as follows: Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TAP_Master.mdf;Integrated Security=True;User Instance=True

From another computer, I navigate to the publish site, install and run the application with no problems. I have on another computer, the same app with an updated version number that I wish to publish, however the difference is is that this published version does not include the database as I do not want the end user to overwrite any existing data that they may have from the previous version.

I publish the updated version, install it but when the app runs, I receive the message, "An attempt to attach an auto-named database for file".

Any suggestions?

Thanks in advance.

Rashar wrote:

I have on another computer, the same app with an updated version number that I wish to publish, however the difference is is that this published version does not include the database as I do not want the end user to overwrite any existing data that they may have from the previous version.

Please explain what this means. What do you mean by "another computer" is this a different computer than your development computer and the end-user computer? How did you create this updated version of the application, did you just remove the database or did you create a copy of the project?

When you install this "update" is it really updating the original deployment or is it installing a completely separate copy of the program?

Shrot answer: I don't think ClickOnce works like this from a VS perspective. I know it doesn't work like this from a SQL perspective. If you remove the database from your project and redeploy, I believe the database will actually be removed. (I say "belive" because I've never tried this.) You might want to consider an alternate way to deploy your database, I've documented one alternative in my blog, start with this post.

Mike

|||

Yes... It is a different computer from my development computer. Basically, I have the same code on both the development pc and the other pc... The reason being is that on my development pc, I would publish the entire app the database included. The problem I ran in to was if I made a change to the database on the development PC, published it, then have the client pc update their app, it would for some reason give them a new database overwriting any existintg data. It actually worked for me this way, until I decided to establish 2 different publishing locations, and I think that is where my problem lies.

Thanks for your reply and advice Mike!

Regards.

|||

I found the problem. When I published the second time around, the publish created an empty folder under C:\Documents and Settings\username\Local Settings\Apps\2.0.

So I just copied my database into that folder and it worked.

|||

I hadt he same problem en found thefollowing sollution:

This is what I found in web.config

<connectionStrings>

<add name="JopieString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Joop.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

|DataDirectory| is the directory of visual webdeveloper.

Delete this and type the name of the path in which your database is stored (in my case c:\inetpub\wwwroot\etc.)

<connectionStrings>

<add name="JopieString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\App_Data\Joop.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

This solved the problem for me, I hope it also solves yours.

Error "An attempt to attach an auto-named database for file"

Hello,

I have seen some solutions of which I tried on this form for the error I am receiving, but I still cannot get the issue resolved.

Here is my case:

I developed an app using SQL Express as the local data source. I published it to my server using the Once Click install feature. When I look in my project viewer, under settings, My db connection strings are listed as follows: Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TAP_Master.mdf;Integrated Security=True;User Instance=True

From another computer, I navigate to the publish site, install and run the application with no problems. I have on another computer, the same app with an updated version number that I wish to publish, however the difference is is that this published version does not include the database as I do not want the end user to overwrite any existing data that they may have from the previous version.

I publish the updated version, install it but when the app runs, I receive the message, "An attempt to attach an auto-named database for file".

Any suggestions?

Thanks in advance.

Rashar wrote:

I have on another computer, the same app with an updated version number that I wish to publish, however the difference is is that this published version does not include the database as I do not want the end user to overwrite any existing data that they may have from the previous version.

Please explain what this means. What do you mean by "another computer" is this a different computer than your development computer and the end-user computer? How did you create this updated version of the application, did you just remove the database or did you create a copy of the project?

When you install this "update" is it really updating the original deployment or is it installing a completely separate copy of the program?

Shrot answer: I don't think ClickOnce works like this from a VS perspective. I know it doesn't work like this from a SQL perspective. If you remove the database from your project and redeploy, I believe the database will actually be removed. (I say "belive" because I've never tried this.) You might want to consider an alternate way to deploy your database, I've documented one alternative in my blog, start with this post.

Mike

|||

Yes... It is a different computer from my development computer. Basically, I have the same code on both the development pc and the other pc... The reason being is that on my development pc, I would publish the entire app the database included. The problem I ran in to was if I made a change to the database on the development PC, published it, then have the client pc update their app, it would for some reason give them a new database overwriting any existintg data. It actually worked for me this way, until I decided to establish 2 different publishing locations, and I think that is where my problem lies.

Thanks for your reply and advice Mike!

Regards.

|||

I found the problem. When I published the second time around, the publish created an empty folder under C:\Documents and Settings\username\Local Settings\Apps\2.0.

So I just copied my database into that folder and it worked.

|||

I hadt he same problem en found thefollowing sollution:

This is what I found in web.config

<connectionStrings>

<add name="JopieString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Joop.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

|DataDirectory| is the directory of visual webdeveloper.

Delete this and type the name of the path in which your database is stored (in my case c:\inetpub\wwwroot\etc.)

<connectionStrings>

<add name="JopieString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\App_Data\Joop.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

This solved the problem for me, I hope it also solves yours.

Friday, February 17, 2012

Error

I am getting the following error

"An error occured during local report processing.Error during processing of 'Validate' report parameter "

Any idea about this error

Do u have any default values or available values for your 'Validate' parameter? If yes, can u give the details?

Shyam

|||

Yes I have default values.That value depends on user selection.If the date difference is less than 15 days.Script will be raised(That I have written using custom code).

|||

can u pls type the whole custom code you have written and then the expression you have used for the default value of the parameter?

Shyam

|||

CUSTOM CODE:

Function CheckSignificantDate(i as integer) as Integer
Dim msg as String

msg = ""
If ( i = 15 ) Then
msg=" Date Diff should be more than 15 Days"
End If

If msg <> "" Then
MsgBox(msg, 16, "Report Validation")
Err.Raise(6,Report) 'Raise an overflow
End If
End Function

EXPRESSION:

=CODE.CheckSignificantDate(DateDiff(DateInterval.Day,Parameters!ToDate.Value,Parameters!FromDate.Value,))

Here I am facing one more problem.In custom code if I take condition (i < 15), for each value script is raising.(i.e for every number.ex: 1,24,33,67..... )

|||

why is that extra comma at the end of your expression (marked in red below)

CODE.CheckSignificantDate(DateDiff(DateInterval.Day,Parameters!ToDate.Value,Parameters!FromDate.Value,))

You are calling the code for all values, so better check the date differentce in the expression itself (using IIf function) and then call the code.

Shyam

|||

Could please help me how to call that function using IIF condition.I can't able to do.

|||

IIf(DateDiff(DateInterval.Day,Parameters!ToDate.Value,Parameters!FromDate.Value) < 15, CODE.CheckSignificantDate(DateDiff(DateInterval.Day,Parameters!ToDate.Value,Parameters!FromDate.Value)), 0)

Shyam

|||

But still I am getting the same problem.

|||

Thanks Shyam I got the solution

|||

Dates problem was solved.After generation of script I am getting the following error.

"An error occured during local report processing.Error during processing of 'Validate' report parameter "