Where to store an Access DB in a VB.Net App? - c#

I am beginner of c# in vb.net. My question is where should I keep access databse to making database application. Because when I distribute it what I need to make global connection string that available client pc. client install in any drive so what I should do to complete the vb.net database application. please advice me step by step because I am beginner
Thanks in Advance
Manish

First thing first,
If your client has not installed Access, you will either have to force him to install or distribute your system installer with embedded Microsoft Access Database Engine Redistributable which you can find on this link.
Microsoft Access Database Engine Redistributable usually provides you everything that you need for Access database usage for .NET
You can always put your file in application directory. As GeirGrusom mentioned, it is not a good practice though. You can get the file path as shown in this link.

Related

Detecting and installing SQL Server Express with UWP app

I have written an UWP app for managing employees, timesheets etc.
How do I detect if SQL Server Express is installed and if not installed how do I setup SQL Server Express on the client computer? Is it possible to do it without running the exe file in 'fulltrust'?
I would also like to include the setup files in my app package with the configuration file to run a silent install on the client computer.
I have looked for a answer on many pages but could not find a real straight forward answer.
Some help here would be much appreciated.
when you have access to your client computer, you can run a check program in your setup process via checking if MS SQL Server Express registry key exists or not. If it exists, then it is installed.
Read this doc from Microsoft, there is a code snippet in the doc you can use:
https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2005/express-administrator/bb264562(v=sql.90)?redirectedfrom=MSDN
What do you mean by 'auto-detect' MS SQL Server Express installed'? Not sure what's your use case here.
Normally, you can not auto detect database to use since in many cases there could be multiple databases installed in the environment, and you don't know which one is the right one you are going to use. You have to know which database you are going to use first.
However, if you insist to detect database, you can do the port scan in your network which is really not a good idea.
So guess maybe your use case is unique.

How to run a windows application as a web application

I did a windows application project with C#. Now, I wanna to run it as web application.(I mean, i want to install the application on server and the user from other places can connect to the server with a web link and test it).Since all the user do not have the visua studio software, I forced to do that. May you help me to figure this problem out?
Thanks in advance
You can't do that. You can have people be able to Remote Desktop to the server and then run the application. If you wanted it to be accessible via URL, you have to build a webpage.
Short answer: you can't run a Windows application directly in a web environment. And really there is NO WAY you should want that, either.
If you need remote access to the computer running the instance of your application, that can be done with the right software. I can think of TeamViewer, Radmin and Remote Desktop on top of my head.
If support for multiple concurrent users is required then you have two obvious choices:
Deploy your application on every clients, or
Make a Web application.
Now for option 1, there are different ways to do that. Depending of the complexity of your app you may require a Windows Installer setup package. For this there is multiple tools on the net. My personal favorite is WiX. Free, powerful and easy once you get the hang of it. Most installers will also ensure that requirements for the app to run are met, and install the missing components if necessary.
If all you have is a simple EXE file then you could be tempted to just package (ZIP) it and share it any way you want, but be warned: if the correct .NET Framework isn't installed on the client machine, it won't work. IMHO given the tools at your disposition to ensure a proper installation experience for the end user, you have no reason to do that. You can, however, consider using ClickOnce for this scenario.
If that doesn't help you, then please add more details on what your requirements are, maybe you'll get better advice.
PS: About "not every users having the Visual Studio software"... having VS installed should never, EVER be a requirement for the regular user.
You can't just run a Windows application as a Web Application. You need to re-write it as a web application. The users do not need Visual Studio to run your application as you have mentioned in your question. If you give some details of what your application does then maybe you will get some better help.
If you wrote your application using WPF it is possible to deploy it as an XBAP.
There are restrictions associated with deploying an application this way.
The minimum you would need to do is create a Web Application to host said XBAP.

C# Windows Application Deployment

I developed a windows application using C# that has a database. The database is attached to my local SQL Server Management Studio. Now, I want to deploy my application (C# + database) so that it can be simply installed on other computers using an installer (setup file). I'm so new in this field. Please guide me that what steps I should follow to do this. Thank you.
Follow these,
1) First get some idea on how to create MSI within Installer Class Read
2) Create a command prompt app which should have the logic to create a Database in local SQL server. Check my post here
3) Pack the command prompt exe with the MSI package.
4) Within the insatller class's Install() method write logic to execute the command prompt exe.
There are few things to consider before going for deployment.
Do you have a centralized application? Meaning do you want to host your database on server or you want to deploy on each users machine.If you want it to be centralized then how are you going to access the database. Does your current structure supports it? like are you using SOA to access db or anything else?
If you have decided that you want to deploy your database along with your application on your client machine then you will have to deploy your database along with your setup. You can read a tutorial here on how to achieve this.

Reading Microsoft Access Database 64bit

I have a situation where I'm moving my .NET application to 64bit and I still need to read data from an Microsoft Access database from within C# code. I've had a suggestion where I could write a web service that reads the data periodically from the Microsoft Access and dumps it into SQL Server, so I could then read from SQL table in my application rather than accessing the Microsoft Access database directly.
This has issues like reading from the Microsoft Access database on a specific PC from the web service or WCF service. But I guess an account with relevant permissions would resolve this.
Has anyone else had a situation like this? If so, how have you worked around it?
Thanks in advance for any guidance.
An option might be to link the Access DB to the SQL Server. See Linking Servers on MSDN.
Can you use the ACE OleDb provider to connect your .Net application to Access?
It's a free download, available in both 32 and 64 bit versions. Microsoft Access Database Engine 2010 Redistributable
Note that if you also need to read xlsx in 32-bit application in 64-bit windows, Install MADE 2007 instead of MADE 2010(x86), because same version of MADE 2010(x86 + x64) cannot coexist.

Can I avoid installing SQL Server on client machines?

I have a nice program idea, it will be a very simple application that will save your username and password on a sql server database file, i know how to do it, but the problem is i don't want the client to install sql server in order to add or remove a record in database, besides i want my database file embedded into the application so the user have a single .exe file, i heard about a library called sqllite or something, it`s function is not to let the user install sqlserver to make the application work.
You can use SQLCE and search for SQLCE private deployment, basically it is a light weight of MS SQL on client side. With privatedeployment you just need to copy related DLLs to your project folder without installation.
You are looking for SQL Server Compact edition.
You need to use a file based SQL database.
There are several - most popular are:
SQLite
SQL Server CE
See this SO question - Free portable database.
As you mention, Sqlite is an option. It's a compact and file based database. No need for installing anything. The full database resides in a file. You'll need to reference the Sqlite database engine for connecting to it, however.
I probably wouldn't use SQL at all if you are only going to create one table with a few (< 100) rows. Its way to much overhead for that small amount of information.
I would save the username and password in a file, then use the Enterprise Libraries Cryptography Application Block to secure the file.
You also most likely don't want the storage engine embedded into the exe, then your passwords are tied to that specific application on that specific computer. You will have to implement an import/export program anyway to move your info to another machine.
Check out http://keepass.info/
Yes , you can implement it by
SQLite ,
SQL Server CE ,
Or Xml
And also , in my last project , the application call the webservice when need to access DataBase.
So , there are lots of ways to avoid install SQL Server on client PC .

Categories