Custom Database - c#

Do i could make the database like this?
**Note: One table named "Database" with on the left is "Student Name" and on the top is "Month Payment", the CheckBox is the CheckBox in c# winforms.
What I know is I couldn't make the "Student Name" on the left corner, the text should be on top like the `"Month Payment".
But, is there a way that i could make my database like the top image and display it on the datagridview and the checkbox is replaced with the checkbox that available in c# winforms, and whenever i open my database (through system), i can check or uncheck the checkbox without have to open the "(databasename.accdb)". Is there a way?
Thank you!
Your answer will be great appreciated!

You should seperate the thoughts of designing a table with displaying data in a table. Consider such a database design:
A table named paymeht, with columns std_name of varchar, Jan, Feb ... Dec of bool (bit).
I should allow you to modify data using check box for those bool(bit) columns. And, only after fetching data from database in your code, you try to display that data in the way you like.

First of all, you should name your columns in a non-separate naming like StudentName or Student_Name. I don't know why don't the image appear to me, but you can display it of course on a datagrid with replacing you want.

Related

SQL server with C# - Fixing nvarchar(50) to fit listview display

I use an SQL database, and I query it for data. some of my fields are of type nvarcar(50). therefore, when I populate them in a listview, i get annoying three dots (...)
e.g: [China ...]
How can I get rid of it?
I am a new user so i can't upload image, sorry.
You'll want to autosize the column using AutoResizeColumn()
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.autoresizecolumn(v=vs.90).aspx
I assumed winform since you didn't specify.

Update a data row inside an asp.net Data Grid View

I think it would be easier for you to understand my problem if I explain the scenario a bit.
What I am doing is developing a system to a doctor using asp.net c#. For the creation of the prescription, I add a check box list for the list of medicines and submit button below it. When the submit button clicked selected check box list items added to the sql server database and show a data grid with the selected medicines in the same page.
In the data grid there are two columns for medicine name and dosage.Medicine name is taken from the database.I need to give the user the ability to enter the dosage through that grid view. I need to use update command because the record is already there in the sql server.But empty value in the dosage column.I tried to use update command in the data source control. But I can't figure out how to give the WHERE clause because I can't specify the database row which the updating record relate to.
I would be glad to hear some help from you. All the comments are welcome.
You need to set a parameter(s), please check this example to understand how it works. I guess, that you've added in the database some column that is unique identifier.. some autoincrement int or guid.

How to bind a existing column of DataGridView with datetimepicker control

I have gone through many articles but everyone redirects to
How to: Host Controls in Windows Forms DataGridView Cells.
But the problem lies here is that I dont want to add new column to my DataGridView which the article says to do it.I am having a DataGridView which is filled through the DataSource property of Grid.The data is coming from the database and filling the Dataset which indirectly fills the DataGridView.
So would like to ask how to add datetimepicker to my existing column of datagrid using the above article.So far I have created three classes namely CalendarColumn.cs, CalendarCells.cs and CalendarEditingControl.cs.
Also would like to ask about the NULL values the column has.Will the Null values will be handled by the classes or do we have to add some code?
The Output m getting is something like this---
and I want that extra column(Unnamed) not to appear in the Grid and show only the DateOfBirth column with DTP control as shown below--
Any links or articles would be appreciated.
Thanks in advance.
Take a look at this article, I hope it will be useful: DataGridViewExtension.

work with data grid view in C# windows forms

Dear sir,
I m developing one application on c# windows forms by using OLEDB connection.On that one form i placed one datagridview and bind to one table.That table contains some fields....., here my problem is i want to edit table on runtime.On that table i need two links as edit,unmask.In runtime data in datagridview is seems to plain text on paper.if we click edit that row changed to text boxes and combo boxes.Sometext boxes contain passwords also.those are in ** formate.while picking unmask button those passwords are changed to actual text.while picking edit button that exploted to update, cancel.Then we change the data and pick update then data stored to database table.(i need datagridview as gridview in ASP.Net).Is there any properties for datagridview as gridview(ASP).Could you please suggest me how to resolve my prob.
Thanks in advance.
Can you, at the time of the hang, hit pause in Visual Studio to see where your code hangs?

How to display value from SQL Server database in input box?

I would like to do something like simple data binding in Windows Forms, but in Web Forms. So I would like to get data from a column NAME from table CATS (one row) and display in on website in text box (input type='text') and next I would like to click on "save" button to save this data to database doing an update.
Could you please give me a short snippet of how should I do it to work and get understanding of how does it go?
Really easy updating can come through the detailsview control: https://web.archive.org/web/20211020133929/https://www.4guysfromrolla.com/articles/050207-1.aspx

Categories

Resources