1,105,578 Community Members

stored procedure update check checkbox

Member Avatar
trilju2005
Newbie Poster
3 posts since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I have to create a stored procedure that will view data from a table. The user will audit the data, with paid dates. The user comes back to the view report, check/select all lines that have the same paid dates to change. The user will enter the paid date, then click a button and update all the records selected.

Will I need to have the checkbox field in the table?
Is it something that the user only has to see in the viewed report?

I am just not sure how to add this checkbox. :'(

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

A single stored procedure can't really be used the way you seem to describe your scenario. In MSSQL table structures there isn't any such thing as a "check-box" (which is really a GUI convenience for displaying a binary T/F value).

Without more information about your specific situation, I can only offer general guidance.

There are many reasons to use a stored procedure, but generally you use it to do data manipulations that you don't want to burden your client machine with. That way you can have your client machine worry about how to DISPLAY the data (which it is much better at) and let the server worry about the "heavy lifting" of storing and retrieving your data (or subsets of it).

One scenario might be:
1. Have your program ask the user enter a search term
2. Have your stored procedure do whatever manipulations it needs to to return the data asked for.
3. Have your program format and display the data, and accept "check-box" selection.
4. Have your program loop through the displayed data, and call a second stored procedure to update the selected data rows.

Perhaps if you describe your situation more fully, it will be possible to offer better help.

Member Avatar
trilju2005
Newbie Poster
3 posts since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I did not think that it was possible. (I am very new to some of this)

This is the senerio:

User views a report and prints it.
User checks each report line to see if it was completed, if it was they right done date.
They go back to report and selected all report line items with the same date and then in a textbox enters the date and it is updated in the database.

Would this be a gridview and can i do a gridview in sql server? and can it be done in a stored procedure?

Or do i create a report in Visual Studio and attach a stored procedure to it?

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

You're confusing your DBMS with your programming environment. I don't want to come across as condescending, but if you are new to programming you might need to gain understanding on a few concepts.

DBMS is an acronym for "Database Management System". A DBMS is used to store and secure data, enforce rules about data, and manipulate and retrieve data. It is designed to accept requests (usually in the form of SQL statements) and perform manipulations or return result sets. It has limited capabilities in terms of formatting. It is for data and data alone.

A programming environment is where you write programs which may or may not need data. You can use it to create GUI programs, non-GUI (console) programs, services, libraries, web pages, graphics, printouts (like reports, but simpler), and a host of other things.

Generally, a report is used when the programmer simply wants to display static data and has no need to update that data. A user interface is built when it is necessary to manipulate data.

For a report, it is possible to use a stored procedure to retrieve the data. The stored procedure is a "mini-program" entirely under the control of the DBMS. You "call" it and (in many cases) pass parameters, then retrieve the results if any are returned.

Depending on the style of the user interface and the controls used (such as GridView), each control can be tied to either a database table, a query, or a stored procedure. When a control is tied to a stored procedure, it is generally not updatable. If the control is NOT tied to a table, query or stored procedure, it must be programmatically populated (i.e. in your code), and then any updates must subsequently be pushed programmatically to the DBMS, with either dynamic SQL statements or ADO connections/recordset objects.

It gets more complicated from there, so I'll end off. I don't know if any of this was useful to you, but I just wanted to make sure you understood that the path you were starting down had many apparent false assumptions of how the various parts fit together.

Member Avatar
trilju2005
Newbie Poster
3 posts since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

It was how it was presented to me, that made me confused. I am new to somethings, but I didn't think it was possible. I wanted to do it different but the other person i was working with had other ideas that i didn't think was possible but some of this stuff is a little new and i didn't know if it was or not.

Thank you for taking the time to respond to me.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article