How do I deploy the data to the %programdata% directory when compiling a executebal in vb.net - sql

I created.exe file and installed it on my machine.When I insert data I get an error "Failed to update database "Database.mdf" because database file is read-only". I am able to view the data but cannot insert the data. I am using local sql database and visual studio 2019. My connection string is:
Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\HovedDatabase.mdf;Integrated Security=True
I have read a lot of topics on the forum about this and so fare I have changed the settings to the db in the SSMS, so that it is not longer a permisson issue.
But it still gives the same error. One thing I havent tried, because of lack of skill, is deploying the data to the %programdata% directory. It looks like this advice is given regarding this issue. So anybody have a idea on how to do this in Visual Studio. I am pretty new to this so dont be afraid to give detailed instructions :) Thank you in advance :)

Related

Azure SQL Server Database creation not working correctly

I have Azure and I just upgraded to the Pay-as-you-go option as I though being on the trial might be causing my issue, but it persists.
I try to make a database in SSMS and I get this error saying I don't have the right subscription:
The reason I want to do it from SSMS is because when I try to add the database through the azure portal it doesn't show up in the sys.database table:
One of my databases is dependent on another and can't find it when trying to add a stored procedure because it doesn't seem to be registering correctly with master.
What is going on and how do I fix it?
I figured it out. When making a new database you need to go to options and change service level to basic.

Create a Sql Server Db from WIX in a specific location

I'm trying to have WIX create a database in a location the user specifies. I've got it working for the most part using some CustomActions and passing parameters to a sql script. But am having problems with permissions on the directory I'm attempting to create the DB in.
Searching for a resolution to this problem lead me to a post on here that I had not seen before today (Wix: create a sql server database at a specified location) where it seems like someone accomplished the same thing I'm wanting to do.
It is not clear from that post how the user was invoking the script? I am hoping they were doing something like the code code snippet below and I just don't know how to pass values to the script. If so, that would greatly simplify my task.
<sql:SqlDatabase>
<sql:SqlScript>
</sql:SqlDatabase
Can someone tell me how to pass values to a SqlScript when not using a customAction to invoke the script via sqlcmd.exe?
Thanks.
For the future reference of anyone else wishing to do this there are a couple of ways to create a database at a specified location. The simplest of which is using the wix tags that I did not know existed:
<sql:SqlFileSpec Name="DataBaseFile" Id ="mdfFile" Filename = "[DBDIR]TestDataBase.mdf"/>
<sql:SqlLogFileSpec Name="DataBaseLogFile" Id ="ldfFile" Filename = "[DBDIR]TestDataBase_Log.ldf"/>
This works perfectly as long as the directory that the database is being created in is not under "Program Files" or "Program Files (x86)". Both of these locations seem to have special permissions to them that don't allow SQL Server to create a database there. This theory can be tested by trying to create a database using Sql Server Mgmt Studio in a folder somewhere under Program Files and looking at the error that is produced. Which is something like this for me:
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file
I'm still trying to figure out how an installer can accomplish putting a database under Program Files as I'm sure it's been done before.

Get Cannot find column [SchemaName]. when trying to add Table to imported SSAS project

After importing my SSAS project from the prod environment into visual studios, it seems that I can't add any new tables to the datasource view.
This is the error msg I get:
"TITLE: Microsoft Visual Studio
------------------------------
Cannot find column [SchemaName].
Any idea what is wrong and how i can fix it?
using SSAS 2008 and connecting to Sybase IQ 15.2.
I was able to resolve this one but what all I understood was it is a Visual Studio bug.
I re-installed the Visual Studio and it worked fine. I got this idea because I was able to do the same thing, without any errors, from another server (a different system basically).
So, you can try that.
P.S. All the best.

Visual Studio Adding Data Connections - Given Key not Present in the Dictionary

I've read through a couple of previous similar questions and none seem to provide a fix.
so i ask again.
I'm using Visual Studio and am trying to connect to a DB in Server Explorer. Regardless of what database i try to connect to it gives a "Given Key not Present in the Dictionary" error.
i have tried with SQL CE and SQL Express 2008 databases and each give the same issue.
I can connect quite easily with SQL Management Studio Express so i believe the Databases are the same.
Thanks in Advance.
after a lot of time searching for the answer to this i found the solution here
this is not really a workaround but in fact a SOLUTION, how to get rid of the error, in case you have missed to remove all connections before removing the provider:
edit C:\Users...\AppData\Roaming\Microsoft\VisualStudio\10.0\ServerExplorer\DefaultView.SEView and remove the connection with the wrong Provider manually. If you do not know which of the provider is failing, simply delete the file :)
If this won't help try deleting also C:\Users...\AppData\Local\Microsoft\VisualStudio\10.0
PS: you have to quit all instances of visual studios first or the files will be re-created from memory ..
The second part only worked for me , deleting the whole folder.
I had recently installed the MySQL Connector, and had multiple instances of Visual Studio open. After shutting them all down, I was able to add a connection to the Server Explorer.
Adding to what BastanteCaro said, I had open the DefaultView.SEView file in case I needed to go down that path. When I shut everything down and started up a new instance of Visual Studio, Notepad++ reported that the file had changed. So either there was an uncommitted change to the file or some sort of cleanup/addition was made on startup.

Data from UniData to SQL Server 2005/above through SSIS

We are doing a feasibility on what we're going to propose as a solution to a client who wants to migrate to a .NET based solution. Part of the data resides in UniData. What is required can be achieve using the following tool:
http://www.welland.com/export.html
The above product ETLs data from UniData to SQL Server.
As a first step, we want to be sure that there are no hitches in getting the data through SSIS from UniData to SQL Server.
Since we don't have an environment to test this we have to check mostly on the net. But most of the discussions regarding UniDate and SSIS don't look like the problem got solved. The main problem seems to be that people aren't able to get hold of a proper ODBC driver. If the data is converted into XML, then it looks like it's working fine.
Has anyone done this and know that this can go through without any problems?
Cannot say I've done it, but Rocket Software has 2-user license versions of UniData available for download, so at least you would have a system to test on.
We are actually working on this process now -- Unidata to SQL through SSIS. We worked with Rocket Software to get the OLE DB working... ODBC was never fast enough and before there was not OLE DB... Now there is. You have to do some work on the UNIDATA side once the OLE DB is install but that is an answer for another day. So far we have no issues except the work to get it setup.