When I go to add a project data source for my datagridview there are multiple connection strings to choose from on the choose your connection page. I have already deleted the multiple strings out of the app.config and tried deleting my dataconnection all together.
They are still there. Where am i missing?
thanks!
The connection strings you see are the ones that are defined as "Data Connections" in the Visual Studio Server Explorer window. You can delete entries from there that you no longer need. (View -> Server Explorer, or CTRL-ALT-S in VS2010.)
These are stored globally, in this file:
%appdata%\Microsoft\VisualStudio\10.0\ServerExplorer\DefaultView.SEView
You can just delete that if you want to get rid of them all, or try to edit it; for some silly reason it's formatted as a SOAP message. (The nodes you want are <DataViewNode> elements.)
Make sure you remove them from your projects first, though; from what I have seen, if you open a project that uses a data connection that you don't already have defined, it will be added into your Server Explorer list automatically.
If you deleted them from the places you've said and you've deleted them from under your project Properties, DataSources folder the only other place I can think of is on the actual Form itself.
You'll either see the datasources listed in the component tray beneath your form in the designer or you could open up your form's .Designer.cs file and do a find for the datasource names you are seeing in the DataGridView wizard.
Related
I am new to visual studio.
I made an app using excel vba that converts words into code 128 and display them.
I tried to recreate it, with visual studio, but I have no idea how to create a file that store data.
For example, the barcode code 128 table should be accessible through code to convert a simple text into a barcode view.
I know so far how to create service based database on sql, add column, and rows, but I need to know how to have (or create) a file with stored data to work with (like in excel, you create a sheet filled with data, and then, you can adress it using vba)
You've a really good tutorial's on the internet who helps you building a local database on visual studio.
I'll give you a initial steps to build one:
1st: After you create your project, Go to Project > Add New Item > And Choose Service-based Database
2nd: Open your database located on Solution Explorer with the name: nameyouchoose.mdf
3rd: It will open a DataSource on the Server Explorer where you can add your tables, records, etc...
Good tutorials:
docs
devu.com
Something happened to some of the files in my visual studio project so I had to transfer the working files to a new project.
Everything is working fine except when I try to add new stuff to my database (like a new column) linq to sql does not recognize the changes.
At one point (I think when I opened up the dbml file) something popped up on visual studio saying something to the effect, that the link to the database (I am not sure if it mentioned web.config) is incorrect so they are just going to use the link in the dbml file (or something like that).
How do I get the correct link? and where do I put it?
So linq to sql will recognize changes?
You can right click on any white space on your ".DBML" file and then go to properties option. You'll be able to find the "Conexión(Connection)" option in where there'll be listed all your SQL connections, just pick one and that's it.
Once you have this done Visual Studio will recognize your future changes.
Note: This will help you to establish or change the connection with your SQL server. If you want to update your DBML scheme you can read this: How do I update a Linq to SQL dbml file?
This is a very noobish question:
I don't understand SQL. I'm trying to make a generic connection to an empty SQL database in C#. I don't want to make tables in advance, I just want to be able to open the connection.
Every "connectionstring" I try results in "InvalidOperationException" so I need some help understanding the proper syntax to connect to a SQL data file in Visual Studio.
What I have done is gone to "Add -> New Item -> Service-based Database"
This gives me a "Database1.mdf" in the solution explorer.
Now I want to open a connection through C# to this file at which point I can use SQL strings to manipulate the file.
I believe the next step is to use: SQLConnection SQLConn = new SQLConnection(" ... ");
But I don't know what to put for the "server" or the "database" in the connectionstring.
Can someone tell me the most basic way to connect to a "Service-based Datasource" in C#?
Will this "service-based database" be included in the final compile? E.g. if I compile a finished executable, will each installation come with its own local SQL database?
The service based database will not be embedded in the dll. See the last section of the below (in bold) to see how to obtain the connection string.
From an MSDN article (http://msdn.microsoft.com/en-us/library/vstudio/ms233763%28v=vs.110%29.aspx):
To create a project and a database file:
Create a Windows Forms project that's named SampleDatabaseWalkthrough.
See Creating Solutions and Projects.
On the menu bar, choose Project, Add New Item.
The Add New Item dialog box appears so that you can add items that are appropriate in a windows Form project.
In the list of templates, scroll down until Service-based Database appears, and then choose it.
Name the database SampleDatabase, and then choose the Add button.
The Data Source Configuration Wizard opens.
On the Choose a Database Model page, choose the Dataset icon, and then choose the Next button.
On the Choose Your Database Objects page, no database objects are available because the database is new.
Choose the Finish button to create the database and dataset and add them to the project.
The properties window for the database shows the connection string and the location of the primary .mdf file for the database. To display this window, choose the Server Explorer tab, expand the Data Connections node, open the shortcut menu for the database, and then choose Properties.
So I have a database filled with values already. It works fine, until I start to query any values I have added into it. It just won't work.
I'm using a project on Visual Studio creating a Web Form, while the database connection, as well as the add, update, and delete methods, are stored in a DLL that I referenced.
The adding works, and so does the updating. I can see it in the database through the server explorer, but I cannot query what I am seeing. I tried querying values I did not add, and it works. When I query the rows I added, it won't work.
Let me know if you need anymore information. I have no idea what's going on.
I've encountered a similar issue and the catch to it was that it was actually using another database. I'd recommend you check with SQL Server Management Studio and make sure you're using the correct database and also have a look in Webconfig.
I have a local, SQL Server Compact database in an application I am creating. I generated a .dbml file I can use for LINQ-to-SQL purposes using the SqlMetal.exe tool, which worked fine - I now have the table objects for use in my application.
I have a strange issue though. Even after calling SubmitChanges() on my DataContext, the data never commits. But strangely, after adding the rows, these rows do appear in the table object on the datacontext, but not in the table. What shocked me is even after stopping and starting my application, these rows still existed in the DataContext - but after a few minutes they seem to disappear.
Have I configured this correctly? Are there any more steps I need to do after using SqlMetal to allow the LINQ to commit changes?
I am assuming that you linked to the dbml file using the default properties. This means that, each time you start a debug session, the file will be copied into your output directory and changes made to it will only be seen for that session (i.e., "Copy -> Always").
If you want the changes to persist then right click the file -> properties -> Copy Never. By default the IDE assumes that you don't want to modify the original database, only a copy for debugging purposes.