How can I show folder directory of the server file path (base on SQL server installation computer's folder path) on the client computer when I open FolderBrowserDialog.
I have the SQL server backup function and this function needs a directory for the backup location. So when I want to back up the database on server computer I need to show the server's director on FolderBrowserDialog.But now when I open the FolderBrowserDialog in the client, Its show the client directory.
Set the path via the FolderBrowserDialog.SelectedPath property
Related
I am currently having a problem when uploading a file using a file upload control in asp.net
I have published my page using IIS on a remote server and I am accessing that link on my local computer.
Currently when im trying to upload a file I get an error saying that path not found meaning its looking for the file path that is on my pc, on the server which of course doesn't exist.
How do I get this to get the path from my pc because im trying to copy/saveAs the file from my pc to the server.
My code:
String pathCombine = System.IO.Path.Combine(destinationDirectory, Path.GetFileName(file));
File.Copy(sourcePath, pathCombine);
I am facing issue in my web application which is made in asp.net. I have host the application on IIS server.and I am going to upload excel file to port data in database from application.when i uploading from locally from server itself its working fine but i when i try to uploading using public ip or outside then my application redirect to IIS root folder can any one tell me whats is the issue.
this could be an permission issue on your web.config, file and folder permission or maybe a missing reference to correct folder.
Web.config
What is the authentication ? Do you allow Anonymous access. I understand that you can upload fine if you open the side from localhost from the server itself. Did you try to open the side with public ip from the server itself ?
Application Pool in IIS
Look for the "Identify" configuration and set this to "ApplicationPoolIdentify"
File Permission
Look for the folder and ensure that the "IIS_IUSERS" got write permissions
Code Try to sepecify the correct path using the server.MapPath()
Dim myPath As String = Server.MapPath("foldername") & "\" & "filename.csv"
I have a program that connects to .mdf using SQL Server 2014 localdb. It needs to install to program files so it can't use click once. That being said, when I build it with click once. it works perfectly np.
However when I install it via install shield i get this exception
The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file C:\Program Files (x86)\King Canine\King Canine Software\CanineDatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I have the SQL Server 2014 LocalDB as part of the redistrib selected and it is installed on the computer I'm testing it on.
Has anyone ever had this issue before or have any idea?
Based on the error message you posted, it can mean either of the following:
A database with the same name exists
this means that the database you are trying to attach already exist on the database.
specified file cannot be opened, or it is located on UNC share
you can try to check if the folder of the .mdf file you are trying to attach has enough folder access rights, you can see this on the folder's properties, in the security section.
Change the connection string like this:
string connectionStr = #"Data Source=(LocalDB)\MSSQLLocalDB; Database=CanineDatabase.mdf;Integrated Security = True";
Make a T-SQL query for make Database in server:
USE [master]
GO
IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = 'CanineDatabase.mdf')
BEGIN
EXEC sp_attach_db #dbname = N'CanineDatabase.mdf',
#filename1 = 'C:\Program Files (x86)\King Canine\King Canine Software\CanineDatabase.mdf',
#filename2 = 'C:\Program Files (x86)\King Canine\King Canine Software\CanineDatabase_log.ldf';
END
GO
How to construct root path from registry editor when execute program in web server,while executing in local path i am getting as ""C:\Users\Desktop\SPHelper.exe" "%1"" but in web server i am getting in this format ""webserver\Dot net upload\SPHelper.exe" "%1".
How to construct root path in web server in complete format? for example("\\webserver\Dot net upload\SPHelper.exe""%1")
Hi We can use this to find the Location
System.Reflection.Assembly.GetExecutingAssembly().Location
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