I'm exporting a crystal report 2008 to pdf in C#.
The crystal report is connected to sql server 2008 using odbc.
I want to deploy this in a different system. it works if the db name is the same.
Is there a way to supply the db name dynamically. I tried
repDoc.SetDatabaseLogon(db_username, db_password,server,db);
and it fails with the error below
Logon failed.
Details: [Database Vendor Code: 18456 ]Database Connector Error: ' [Database Vendor Code: 18456 ]'Failed to open the connection.
Details: [Database Vendor Code: 18456 ]Error in File denial_completed_letters {84E1BDEF-C60B-46E1-9080-77F699692270}.rpt:
Unable to connect: incorrect log on parameters.
Details: [Database Vendor Code: 18456 ]
Good news / bad news: the bad news is that you can't use SetDatabaseLogon to change the db name. The good news is that you can use another function, ApplyLogOnInfo to do that:
http://msdn.microsoft.com/en-us/library/cc411352(v=VS.90).aspx
http://msdn.microsoft.com/en-us/library/ms226184(v=VS.90).aspx
Just get the logon info from the Table.LogOnInfo constructor, change the values, and call ApplyLogOnInfo.
Sounds like your database server isn't configured for both NT and SQL authentication.
or you can use sa user that have access over target database.
For Windows 7, try to install your application by Run as Administrator and set the run as administrator compatibility to the exe. To set Run as Administrator compatibility to the exe right click on the exe then go to properties -> compatibility, check the Run as administrator checkbox and click OK.
Related
I am creating a POS system in Windows Forms (C#) in which I use a SQL Server database file (.mdf) to store items (completely offline). When I install the application on my computer, it works fine, but when I install it on my clients PC, an error happens:
(provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation"
I read somewhere that the problem is caused due to the fact that the connection string of the database of my client's PC is different. I tried to add the connection string dynamically on runtime but again it only worked on my computer.
Another reason that might be causing the problem is that I used 'server-based database' since local database option isn't available in Visual Studio 2017 for some reason.
Another solution I looked up stated that I should install SQL Server Express on my client's PC. That also failed (maybe I have to set it up in a way or something).
I also tried adding the database.mdf and database_log files in the setup folder.
Lastly I tried installing 3rd party installers (Advanced installers 15.8 and InstallShield Wizard in VS 2015) which also failed.
(I have provided the code for the connection of database taking place and the connection string)
public void ConnectToDB()
{
DBConnection = new SqlConnection(#"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\Users\SAIM NASSER\Desktop\app layer\data layer\Database1.mdf; Integrated Security = True");
DBConnection.Open();
ResultSet = new DataSet();
}
If I understand you correct, you want to use LocalDB
That means using Sql Server without installing a full sql server, but just the localdb part from sql server express.
For this to work you need to install the LocalDB Driver, which can be found here
https://www.microsoft.com/en-us/download/details.aspx?id=29062
You need only the ENU\x64\SqlLocalDB.MSI
This is the only thing you need to install in your clients computer, I believe it can also be installed silent, you have to research a bit for that.
And yes, you also should change the connection string on the clients computer, you need to alter it so it points to the MDF file on the clients computer, because that location will probably be different then on your computer
EDIT
To get the connection string working, you can try this
On the clients computer, create a text file and rename the extension to .udl
So for example you have a file test.udl
Now from explorer, double click it, this will open the datalink editor.
From here you can enter/choose different settings, and click on the test connection button.
Once you get a working connection, save it, and open this file with notepad.
Inside you will find the working connection string
Hope this helps
I am receiving the following error from ADOMD while trying to connect to my SSAS Server.
An unhandled exception of type 'System.Xml.XmlException' occurred in
Microsoft.AnalysisServices.AdomdClient.dll
Additional information: Element 'return' was not found. Line 5,
position 2.
I can confirm the following:
My Connection String Is:
Data Source=<MyServer>;Catalog=<My SSAS DB>; UID=<MyDomain>\<MyDomainUser>;PWD=<MyPassword>;
I can confirm that my connection string is correct ( or at least the data I am using in the connection string above is correct). If I change any part of the connection string to an incorrect value the ADOMDConnection will return "Cannot connect to server". I have also looked at the audit logs on the server itself and confirm that I am successfully logging onto the server. And the contrary, with incorrect credentials the server logs confirm a failed login.
I am trying to connect to SSAS 2014 Enterprise
The failed connection returns within a few seconds. A few posts out on the internet suggest increasing the Connection Timeout property. This does not seem to be my issue as I have increased it to 120 and its failing within 5.
I am using ADOMD 12.0 Runtime 2.0.50727
My domain user is a domain admin and has been added to an admin role in the SSAS.
Im not sure what else could be wrong or how to debug this or is this a known bug in ADOMD?
Any advice would greatly appreciated.
thanks!
Jason
This happens routinely when the version of the ADOMD client DLL is not a version that matches the target version of the server instance. For example, Azure Analysis Services as of 09/13/2017 does not work with Microsoft.AnalysisServices.AdomdClient.dll version 13. Only version 14 and above.
For reference, the ADOMD DLL for Azure Analysis Service is available in the link below:
https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers
Double check to make sure the client DLL is the exact version needed for the target server instance. That solved this exact issue in my case.
I have currently upload my asp.net file which contains crystal report in Website host: (somee.com), but the crystal can't work in somee.com.
Error message:“Error
Failed to open the connection. Details: [Database Vendor Code: 17 ] Failed to open the connection. rptUsers {BFFF26F5-4E99-4153-9D71-67B92F5924D9}.rpt Details: [Database Vendor Code: 17 ] ”
How can I solve this problem?
Here is my the website I upload in somee:
http://yuanyuanhong.somee.com/Reports/Users.aspx
*Try to login with:“Email address:964104381#qq.com;password:5780231" in able to access the above page.
Thanks.
Could be several issues: can't connect to database, path to report file incorrect, permissions issues for the web user, no crystal runtime installed on the server. Judging from the error you have an issue connecting to the database. Do you have a DSN (Data Connection) on your development machine that you don't have on the server? Does the web user have access to the database?
Something to start with....
Chris
I'm getting the error below while starting the storage emulator. By mistake I deleted the mdf and log files in users/admin folder. It's holding reference someplace and not allowing me to create the DB again. Please help me.
Added reservation for 127.0.0.1:10000/ in user account RaviBorra-PC\Ravi Borra.
Added reservation for 127.0.0.1:10001/ in user account RaviBorra-PC\Ravi Borra.
Added reservation for 127.0.0.1:10002/ in user account RaviBorra-PC\Ravi Borra.
Found SQL Instance (localdb)\v11.0.
Creating database DevelopmentStorageDb201206 on SQL instance '(localdb)\v11.0'.
Cannot create database 'DevelopmentStorageDb201206' : Database 'DevelopmentStorageDb201206' already exists. Choose a different database name..
One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. Please refer to http://go.microsoft.com/fwlink/?LinkID=248088 for more details.
Thank you,
Ravi Krishna B.
Do these steps:
Open cmd.exe (Command Prompt)
Write this:
SqlLocalDb stop "v11.0"
SqlLocalDb delete "v11.0"
and press Enter
Note that "v11.0" is MyInstance.
For more details, visit this link.
This problem may occur if you delete the data file C:\Users\<Username>\DevelopmentStorageDb201206.mdf but do not delete the corresponding database on the LocalDB server instance. One possible solution is:
Connect to the (localdb)\v11.0 instance from SQL Server Management Studio.
Delete the DevelopmentStorageDb201206 database. There will be the error message that the database deletion ended with an error. Ignore this message and refresh the database list manually.
Now you can start the Azure Storage Emulator.
This is not a problem related with Azure components rather LocalDB instance is reporting back to Azure request that DB still exist. Check LocalDB instances in your machine using "sqllocaldb i" first and the delete the instance using "sqllocaldb d 'instance_name'". I could not test it in my machine but this may unblock you if localdb instance is blocking you.
In Windows Azure SDK 1.7, Windows Azure Storage Emulator uses LocalDB instance specific configuration at following location:
%LocalAppData%\DevelopmentStorage\DevelopmentStorage.201206.config
And based on that you will see that v11.0 instance is Windows Azure Storage Emulator specific so verify if that is running and deleting it will let DSInit to create the DB again in LocalDB.
If you have Sql Express installed on your local box then (localdb)\v11.0 is most likely not your local Sql instance. It is more likely {MyComputerName}\SQLEXPRESS.
Going to:
C:\Users\<yourloginname>\AppData\Local\DevelopmentStorage\DevelopmentStorage.201206.config
And changing:
<SQLInstance>(localdb)\v11.0</SQLInstance>
To:
<SQLInstance>{MyComputerName}\SQLEXPRESS</SQLInstance>
solved this error for me.
I hope this helps..
If you already tried and failed perform:
SQLLocalDB stop v11.0
SQLLocalDB delete v11.0
Delete all the files in C:\Users\<accontname>\WAStorageEmulatorDb* (usually one mdf and one ldf)
Create a new account (I called it Azure, with administrative rights)
Run again the installation
Installation completed!
For me this works... I had tried to format the PC before use this way. I supposte my problem is related to my username that contains "invalid" characters like Name 'NickName' Surname while the "Azure" account seems to be OK for him.
I figure it out 'cause somewhere in the log I have a property destination path set to "C:\Users\Name$_" that is far away for the path of my user account folder.
After that you can go on CMD.exe and prompt:
control userpasswords2
From the control you can delete the Azure login without delete the file folders!
Hope it helps!
I simply deleted all the mdf's and ldf's in C:\Users\accountname\ that started with DevelopmentStorage... or WAStorageEmulator.
Re-ran the install and it worked.
This can also be caused by the folder not existing for localDB. It looks like Visual Studio / Azure will not automatically create containing folders. I just copied the path from the error code into explorer and created the directory up to the .MDF file.
In visual studio go to Tools -> Options -> Database Tools-> Data connections and change a localdb instance name from v11.0 to some other name.
I did have SQL Express installed, as Brian Ogden suggested in his answer, but I wanted to try & point Azure Storage Emulator to my SQL Express instance without modifying configuration files.
I did this by running the initialization process for Storage Emulator & passing my server\instance details for SQL Express using the available switches. Below example of the command I executed (from an elevated command prompt):
AzureStorageEmulator.exe init -server MY-PC-NAME -instance MYSQLINST
This created the database successfully (in my SQL Express instance) & got my Storage Emulator working.
I am using a named instance, but I'm thinking this same approach can be used for default instances by omitting the -instance switch.
I want to make a database backup with this C# code:
connect = new SqlConnection(con);
connect.Open();
// Execute SQL
SqlCommand command = new SqlCommand
(
#"backup database MY_database to disk='d:\SQLBackup\wcBackUp1.bak' with init, stats=10",
connect
);
command.ExecuteNonQuery();
connect.Close();
When I run it, the following error message shows up:
Cannot open backup device 'd:\SQLBackup\wcBackUp1.bak'.
Operating system error 3(The system cannot find the path specified.).
If I change the path to d:\wcBackUp1.bak it seems to be ok, is without error, but the file does not exist, it was not generated.
If I run in SQL the command I have the message that it was 100% processed, but I didn`t see the file.
Could someone help me please?
Make sure the location "d:\SQLBackup\" exist in your database server and not on your client machine.
Two things to check.
The Sql Service may not have access to the d:\sqlbackup folder. Old Sql installs used to default to install the service with full access to the machine, but newer instances tighten that up. You could try changing the path to the directory where the default backups are stored.
Secondly, if the sql server is not on the same machine that you are running this program, then you must remember that the D: will be the D: on the sql server and not your local machine
Fundamentally, the Windows account that the SQL Server service runs under must have write permissions on the specified folder.
You can check what account this is by looking in SQL Server Configuration Manager, under SQL Server Services (look at the Log On As column)
Check what permissions that account actually has on the target folder using Explorer -> right click folder -> properties -> security -> advanced -> effective permissions.
One way to check that this is the problem is to change your code to back up to your SQL instance's backup folder, where the permissions are likely to be correct. For example
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup