build setup with database - c#

I have written the code and finished the project. It is a window app in c#. I also have a database in sql server 2005 which I used it in the application. I need to create a setup for it so that any user can install it in his machine. build->publish and then following the wizard is the right way perhaps.. but what about the database?
The same database I made won't be in all computers, so I need that database also bind with my application.

Here is a link to some intro level tutorials, this should get you started. I would focus on creating some sample "Hello World" type applications before you dive into database programming. If you don't start small with this stuff, it can get frustrating.
http://msdn.microsoft.com/en-us/library/aa288436%28VS.71%29.aspx

it sounds like you are looking for basic information on setting up a project, to truly document this is going to take a lot more than a post.
The basic project setup, is done via Visual Studio and the "File" -> "New" -> "New Project" option. You can then select the type of project you need and that will then setup the project for you.
For the database conection, you will want to look into the items in the System.Data.SqlClient namespace.

Related

How to connect sqllite to c# application

Hello I am a new in C# and I have this problem. How can I connect my sqllite database in C#?
I created class named Connection.cs I know I have to get connectionString but I donĀ“t know how to set up it. In my project I have alredy database test.db in main project folder (I can see it in my project in VS)
Can you show me how to make this connection working (some example class or something)? My idea is that I am doing MVP design model so I have to use this connection in my models.
I would show you my code but there is not so much to show. I saw some videos how to connect this but thy always need nugget package to make connection working. Is this only way or is there other option to do it?
Refer to following article to get started with using SQLite in C# application.
https://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application
Recommended practice is to put your database file in App_Data folder of the application. Regarding database connectionstrings refer to following:
https://learn.microsoft.com/en-us/previous-versions/aspnet/jj653752(v=vs.110)
Following is a link to video series on YouTube that may be complete guide to what you are looking for.
https://www.youtube.com/watch?v=XHw4bBLM8Vk&list=PLT3ocvD4YC8iHBHQxFq13r-8rQyQxoJOx&index=1

Pragmatically Open Database connection

I am working on a project and have scoured the internet for answers on this topic but could not find a single answer, not even an open source solution.
Maybe you guys could help me out.
In visual studio you can open the database connection window by browsing View -> server explorer -> add connection. that is all well and known but what if I wanted to open that same form from code or a certain API. I cant seem to figure it out but there must be some sort of way to access this form pragmatically since its native to Visual Studio.
For all who are unsure what form I'm talking about, here's a snippet:
So my question to you is, how can I , through code, open this window? If there is nothing built into Visual Studio and C#, do you know of any open source software that accomplishes this or will I have to recreate it with a windows form application?
I think you would need to build the form yourself if you need any custom logic etc in which case you could use the ConnectionStringBuilder classes and pass the validated fields from your custom form to the relevant builder class to generate the connection string. Visit here for more information.
Microsoft also has library on nuget that you could use, although it's deprecated so use with caution. The nuget file, which you can download manually, also contains the source code so perhaps you could use this to jump start your own UI component. https://www.nuget.org/packages/DataConnectionDialog

Advice on publishing VS MVC3 project to web server

As a company for years we have worked using old ASP (vbscript), we have just started updating to c# .net. our first MVC3 project is ready to be uploaded to the web server for testing and to iron out any bugs.
After reading about it I have made myself fairly familiar with the theory of it.
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
Have all been set to copy local 'true'
Right clicked the solution and selected 'Publish'
Created a new profile
Filled in the connection details, although I am unsure exactly what is meant by the 'Site Path' and 'Destination URL'
As it stands the site path is the scripting path and the destination URL is the URL as it would be typed into an address bar in a browser.
connection does validate.
in setting I have selected release
The there is a little tick box which seems scary to me, it says "Delete all existing files prior to publish" The server I am uploading to contains all our live and test websites, although I have created a new folder for the project, I under no circumstances want it to touch, edit, modify or delete anything else on the server. So this box is unchecked. Can anyone verify that leaving this unchecked will ensure it does nothing to anything else on the server?
Then in preview it simply says "Your application will be published to: (IP address of server)
Can anyone who has done this before give me some guidance this is the correct method to go? I could do it will less worries through a normal ftp but would like to be able to utilise Visual Studios tools. Its Visual Studio 2012.
Sorry if this isn't the exact correct place for this question.
After trying to do this for a while I discovered that publishing to ftp was a waste of time and the hard way to go about things. Although probably alot of you know this.
Instead I just published to a system file and then uploaded it with cuteftp to the web server. This maybe isn't the most professional way to go about things but from someone that comes from a primarily web scripting background, I found this alot less confusing and alot easier to manage.
I just thought I would answer my own question to resolve this thread.

Extending Visual Studio / Team Foundation Server 2010

I am attempting to use a VSPackage to create a Tool window for visual studio 2010. I have all of that created. For my project I am attempting to access TFS 2010. For example when working on a project some files might get checked out and I make changes on them that I don't necessarily want to check in later. Rather that going through tfs and selecting all of the files I don't want to check in(can be very time consuming) I would like to be able to filter files / add files to a "do not check in" type of list. So basically If a add a file / filter for files to not check in. I want some way of connecting to the event of when someone wants to check in, the plugin / tool window can automatically deselect all of the files in the filter/ file list that I have set up. I have a good idea of what I want to do. I just need a good place to start in order to communicate with tfs. So I know I would need to be able to access my collections and also be notified of when someone wants to check in files/ that way I can modify the check in status of the file that I do not want to check in. Hopefully I made sense with all of that. Any help would be MUCH appreciated!!
The class TeamFoundationServerExt (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.teamfoundation.teamfoundationserverext.aspx) may provide what you're looking for.
It contains the current TFS context inside Visual Studio - eg. the team project to which you're connected in Team Explorer.
From there you can get the VersionControlServer object, which in turn exposes check-in related events. More details in http://blogs.msdn.com/b/buckh/archive/2012/01/25/how-to-get-the-tfs-objects-used-in-our-own-ui-integration.aspx.
The blog post mentioned above has a nice code sample.
One last thing: If the files you're trying to filter out can be defined via regular expressions, you can use the Forbidden Patterns check-in policy, part of the Team Foundation Server Power Tools.

Visual Studio 2008 and C#

I'm an IT Professional with a background with developing ASP/VBscript/SQL web applications. I want to take some training and get up to speed with Visual Studio 2008 and C# so that I can take over a project at work and make updates/bug fixes in house rather than calling in a third party.
The web application I'll be working on was developed in Visual Studio 2005 with a mix of C# code and some Ajax.
When I load the source code into Visual Studio 2008 I received a warning that the Source Control Plugin wasn't installed. It's looking for SourceSafe which I don't have. Is this necessary to use?
I'm starting a training course in February called Introduction to Visual Studio C# 2008. Well this be adequate to get me going in the right direction to be able to update, fix, and make minor changes to our web application? This is a big opportunity for me and I don't want to blow it.
Thanks!
SourceSafe is a Software Configuration Management tool from Microsoft, and is not required. I WOULD recommend using some form of SCM, but flavor is a matter of preference.
If the pop-ups are annoying to you and you would like to disable them, then removing the SourceSafe bindings from the project should stop them.
From http://weblogs.asp.net/bkcarroll/archive/2004/03/08/86059.aspx :
Solution:
1 - Go to the folder containing the solution files and delete the following:
mssccprj.scc
MyProject.vssscc
vssver.scc
2 - Open MyProject.sln in your favorite text editor and remove the following section:
GlobalSection(SourceCodeControl) = preSolution
...
EndGlobalSection
3 - Go to the folder containing the project files and delete the following:
MyProject.vbproj.vspscc
mssccprj.scc
vssver.scc
4 - Open MyProject.vbproj in your text editor and remove the following lines:
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
Now you can open the solution/project with no source control errors.
As far as the class goes, if you're already familiar with ASP/VBScript, you can probably pick up a C# class and figure out the rest. If not, I would suggest going for an ASP focused class that utilizes a C# back-end.
I would expect that a course named "Introduction to Visual Studio C# 2008" would probably not cover Ajax technologies, so you might want to look for some additional resources on that topic. (It might not even cover ASP.NET in significant depth, so I'd advise checking the syllabus, and if the ASP.NET coverage is weak then prepare for some additional learning on that topic as well.)
Re the Source Safe plug-in: you will need this if you want to work on the code base (so you can check in and out of the existing VSS repository). You will not need it just to browse the code.
Well James that is up to you. I am not familer with the course but if you apply yourself and pay attention I'm sure you can achive your goal. Do not be afraid to move beyond just course work to learn new things. There is a lot of information about Visual Studio on the internet.
SourceSafe is not required to use Visual Studio.
Learning the basics of VS will definitely allow you to update and fix your web apps. VS allows you to work with all the technologies you mentioned all in one environment. Although ASP/VBScript are "legacy" at this point, there is still support for them in the VS environment.
James I'd suggest that you look at the free resources (video and textual) available to you on ASP.NET. I would presume that once you've read a few tutorials and watched some videos + taken your training course you should be able to maintain the code base. Add in the fact that sites like StackOverflow have a large .NET community and there are always people willing to help.
Good luck

Categories