asp.net with connection to sql server 2008 - asp.net

i am new in using asp.net language and i try to edit code asp.net which is already connected to a database on iis server
the problem that i faced is:
i can retrieve all table that already exist on that database but when i add new table i cannot retrieve it on asp.net "not found"
the same problem when i add new column all already exist column , i can retrieve them except the columns that i added them
but when i edit record , the record updated on asp.net so the problem when i create any thing or alter name of a column
thanks in advance

What sort of data access technology are you using? ADO.NET Entity Framework (one with .edmx file) or ADO.NET (one with .xsd)?
If you are using one of these you need to refresh or add tables in these diagrams too. Otherwise please get your code here so that picture gets clearer.

Related

EF CodeFirst adding table to database

I've got ASP.NET MVC App with database added as Code First from Database. Now I need to create new table in datebase and add column in other. I've create it manually on database, now my question is how can I update database in Visual Studio project to show and allow me to use my created table? I've tried deleted all classes and connection string and add database again, but I've got exception:
"This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection."
Also helpfull will be information/link to tutorial how can I add a table from Visual Studio and sent changes to database.
Thanks for any help.

Visual Studio Server Explorer doesn't display the correct table with DB2 connection

To start off, I'm new to Visual Studio and DB2, so please bear with me. I've been reading different books and will be starting classes soon, but I'm completely stumped with this.
I have a webform set up using VB.
In the web.config file, I've added <add name="rfqAS400TEST" connectionString="Server=serverIP; Database=RFQTST; UID=userid; PWD=password; CurrentSchema=RFQTST;" providerName="IBM.Data.DB2"/> inside of the <connectionStrings> tag. However, when I look at the connection in the Server Explorer, the tables dropdown shows HUNDREDS of tables, none of which are the table I referenced in my connection string.
I've tried to modify the connection and filter by the schema and DbName with no luck - it still only shows the hundreds of other tables instead of the one I want.
When I manually specify a custom SQL statement (SELECT * FROM <library>.<filename/table>) in the GridView Configure Data Source wizard, the GridView displays the records as it should, so I know the connection to the correct library and file is working.
It just seems strange that I have to manually type the statements because the correct table fails to show up in any of the wizards or the Server Explorer. Any suggestions or thoughts would be GREATLY appreciated.
Update
Out of curiosity, I tried to set up the connection using the ODBC datasource and the system data source name as IBM i Access for Windows ODBC. This displays extra tables as well, but it includes the tables that I've been wanting all of this time. This just confuses me more. Does that mean the DB2 connection (even though it technically is connected) is set up incorrectly?
The CurrentSchema is just a proxy for the SET CURRENT SCHEMA, to name the implicit schema qualification, for unqualified table-references. The tables that appear in an ODBC API request such as via SQLTables(), are unrelated to that current_schema.
A generic [db2] provider does not acknowledge\reflect the distinct attributes of the DB2 for i, whereby the database is [in a simplified sense] the entire system; the catalog API calls reflect either that, or that the schemas that are part of the library list concept. With the IBM® i Access ODBC driver, there are Connection string keywords for Connection Properties and Server Properties.
The following Redbooks publication and SQLTables Description may have some value.

Dynamic Data to external database asp.net

I'm stepping through a walk through which allows me to create a dynamic data website.
Though in all the tutorials, including the one above, they all point to a local file based database. I need to add an external data model.
How could I add an external data model to the project? (A database hosted on a seperate SQL Server)
I've tried connecting through the SQL Server Object Explorer then dragging it into App_Data, but that didn't work.
Use the connection string in the web.config, but as you add the EF data model you should be given the opportunity to select you database by browsing for it.

How to update record in database from web application?

I am trying to do a assignment. I want to insert data into MySql from a .jsp page. Data are
ID, First Name and Last Name.
What i understand is I need to create a Input.jsp page where i can input ID, First Name and Last Name and take these values to servlet page and update my table in MYsql.
Does any one know where i can find this example? I am using Jdbc, tomcat and mysql.
First off, be advised that accessing your database directly from JSP is not a good practice. For ease of maintenance you're better off implementing your business logic and database access code in Java. Your JSP's should contain code to display the UI and nothing more. Hopefully your future assignments will have you do this.
Here are two tutorials that will help you with accessing MySQL via JDBC from JSP: JSP - Database Access and Connecting to MySQL database and retrieving and displaying data in JSP page.

Entity Framework 5 code first - where is the database created

I am following along this tutorial! everything works great, the blog names saved and retrieved from the database (assuming) since they are displayed in the console. Yet there I don't find any database created for it in local db nor the sql express on my machine. How to find where is the database created in the code first approach.
You can get the connection string by using ctx.Database.Connection.ConnectionString which will tell you what database you are using.
I was having a very similar problem here. My connection string was set to .\SQLEXPRESS and a generated Initial Catalog name, but when I connected to .\SQLEXPRESS using SSMS, nothing showed up.
Using IntelliTrace in VS 2010, I was able to see the ADO.NET command, and in the Autos grid, it showed me the SQL command and the following connection string: Data Source=(localdb)\v11.0;AttachDbFilename=|DataDirectory|(my_context_name_here).mdf. Then, using the Server Explorer I can connect to (localdb) and see the data.
This problem happened because my context was derived from DbContext, but it did not used the base(connectionStringName) constructor (like the UsersContext that comes with the MVC4 template does). Changing that, I can see the database in .\SQLEXPRESS.

Resources