SQL Server 2008 get modified details - c#

I have a table attached to a gridview in asp.net.
Lets say a user edits a row and updates the text in a textbox. I need to able to know what column he has modified and highlighted (ie make it bold).
This information needs to persist outside of the asp.net session so it would need to come from the DB.
How to go about pulling this info from the DB?

Add one more column to of updateTime in table and create a afterUpdate trigger which will insert updated time in that column.
Now you can differentiate the rows which have been updated recently from all other rows.

Related

ADO.NET Project

I'm trying to create a project which is basically a library management system.
As a display I used the standard DataSource to WinForm drag and drop system, which displays everything shown in the SQL table.
I want the users to be able to see the content of each row in the grid by double clicking it, which would redirect to another page with the selected row number and information to be displayed on each field.
As for the admin side, I want to be able to modify my db (delete, insert).
Is this the right path, or should I draw a grid from scratch?
Also, my SQL table contains images, this is what's bugging me.
The default gridview shows the little red X's in the varbinary column, and I can't seem to get rid of that.
Regarding inserting data into the table, is there any way to add images directly from the system above? Or should I redirect to a new page and code the respective into textboxes and things of the sort?
Thank you in advance.

How to display one selected record using DetailView?

I have a form in ASP.Net Visual Studio that asks for particular details. After the user inputs their details into the database, I then want to be able to view their records and edit it in a different webform.
How can I view that one selected row of records in my form instead of viewing the entire database table?
I thought of using DetailView, however it still shows all the records in the database (just only one at a time).
Then I thought of using sessions but I don't know how about doing this?
Could I possible create a text box to input the persons username (primary key) and then that will open their details?
Update: What I don't want is the DetailView to have other details viewed as well. Meaning I don't want the records of other people on the DetailView as well. I just want the one record of that person, no one else's.
After saving to db, redirect to a new page posting the primary key data using suitable session management techniques & load the details with detailsview

Is Gridview Control a complete solution for Web based SQL Server Database Table Editor?

After a few failed attemps of integrating the existing Web based sql table editors to my solution, I have decided to write my own Web Based Sql Server table editor and I am thinking of using Gridview control for all the online processes on my database, here my questions:
1- Does Gridview a complete solution for SQL Server Database Table
Editor ?
2- Does Gridview the best way to do this?
P.S: What I am tring to do is creating an online admin panel of my application for an end user.
Couple of grid views and additional objects (for image viewing for example) should be enough for basic data editing.
GridView will allow you to view and edit most fields (except binary and images) from SQL table so in this respect it would work. With lookup tables you would need to use another grid view, maybe in read-only mode. It depends what you expect to have in your table editor.
You can use a sqldatasource control bound to a gridview for each table you need to manage. Sqldatasource will create CRUD operations with a wizard and Gridview will generate columns and commands automatically.
As above, you will work a bit to manage images properly, but all other fieldtype can be managed on the fly.
Datagridview is capable of operations in tables in a web interface, however auto creating a datagridview table when there is a new table added to the database is the hard part. For that reasion creating such an admin menu needs hard working, however if there won't be so much table in the application, you can create your admin panel manually with datagridviews instead of writing an own sql table editor tool.

How can i fetch Database column names and how can i manage it

Problem:
SQL Server table is vertical grid with options, i want the same thing to be done in asp.net with c#,
i want to connect the system with the table, it will fetch table column names with check boxes on front, and when we would check or uncheck, the value would be stored in sql server table, as we edit using SQL Server management studio, i want the same component vertically integrated into my web application. Please let me know, can we use grid vertically or there is some control for this?
You will have to iterate through the properties of the table you want. Display this information in a format that you like, and then write various small queries to edit whatever you want to be editable.
http://www.codeproject.com/KB/database/DatabaseSpy_CS.aspx
http://www.sqlrecipes.com/sql_questions_answers/how_get_table_structure_via_sql-92
http://www.google.com/search?ie=UTF-8&q=SQL+Table+Structure+c%23

DataGridView population+modificaion by SQL Server DB View

I searched StackOverFlow.com for my issue, but could not find any similar/related solution.
I have few tables in SQL Server 2005, and have to make use of those tables in my Winform/C# application which is supposed to be an Admin Application where the Administrator will:-
1.Add/Edit users
2.Assign Roles
3.Assign Privileges
4.Zone Assignment
5.Area Assignment
6.Town Assignment
The result of each of these is coming from a minimum of two tables(of SQL Server DB), and this result has to be populated in each individual DataGridView of a TabControl's each TabPage.
The Administrator will first see the results, and then he/she can modify the values via the SelectedRow of the DataGridView, and in response this modification will be updated in the Database(i.e. SQL Server).
Since I am new to programming, my question is that I want to use an
SQL Server View, to get all this stuff done, but haven't used the View in connection to the DataGridView.
Although I am able to populate the single DataGridView from the SQLServer Binded DataSource, but this works only for a single DataGridView, I need to have the data for all the concerned DataGridViews in a single step.
Can anybody tell me how to do this?
If there is any other efficient solution to this, kindly reply.
NOTE:I am using Microsoft Enterprise Library, so would not use any In-Line SQL Queries.
For reference I am attaching the following link with Images.
link text
From what I remember, your Binded DataSource has to be from a single table in SQL. Have you tried representing the data differently? A drill-down to related data instead of showing it all in the same dataset would be your best solution.

Categories