Fill Business Object From Database By Calling Stored Procedures?
Jun 10, 2010
I have several stored procedures in my database, some of them have params, some have no params. I tried to fill a business object by calling the stored procedures, but failed so far. How could I do that dynamically? Later, I want to use this object as a datasource for a report...but thats the next step. The important facts are:
different stored procs return different amount of columns stored procs can have params, but its not required
View 1 Replies
Similar Messages:
Mar 8, 2011
Suppose you have to query a lot of tables and calculate some values and spit it out to the user. Is it ok to have all the business logic for this in the stored procedures? Or is it a better practice to return all the data to the application and do all the data manipulation and rolling up in there?
View 6 Replies
Dec 1, 2010
We have an existing application with a mature database where most of the business logic is in Stored Procedures that are maintained by a separate department. Application developers are not given access to the database except via stored procedures.
I am looking for an example of calling stored procedures from within MVC.
Actually, we have done almost no development until now in ASP.Net at all. Is the difficulty in interacting with stored procedures a MVC problem or is it a more generic ASP.Net problem?
View 10 Replies
Sep 20, 2010
I'm tyring to call stored procedures from asp.net C#.
Initially i created a stored procedure in mysql database which returns a whole table when executed.Bt i'm a bit confused on how to call the stored
procedure from c#.
View 11 Replies
May 6, 2010
Can this be done?
View 4 Replies
Jun 20, 2010
We are building an ASP.NET application with C#.net language and Oracle 9i database. Here we installed Oracle 9i client software on our PCs.We never worked on Oracle 9i database. It's the first time.We are planning to build stored procedures in Oracle database and call them from our ASP.NET application. Does working with Oracle stored procedures and ASP.NET is similar to that of working with MS SQL Server stored procedures and ASP.NET?
View 1 Replies
Feb 2, 2011
I have a stored procedure which is working fine and also code in my vb class, which when I click on save, looks as though it has executed but no information is saved into the database....
My code used to save the data into the database is below.
[Code]....
View 3 Replies
Aug 9, 2012
I have 2 page
1-index.aspx
2-House.aspx
And these are my table in database
1-House_menu Table
Id Name H_name
1 Sofa Furniture
2 Table Furniture
3 Iron Electric
4 Vacuum cleaner Electric
2-House_p Table that save users product information
Id Name H_name Subset Description
1 Couch Furniture House furniture Test1
2 Armchair Furniture House furniture Test2
3 Blender Electric Kitchen Test3
4 Oven Electric Kitchen Test4
I have 1 unorderlist menu in index.aspx
and 1 unorderlist in House.aspx page
I bind unorderlist from database
1-index.aspx
Bind repeater from House_menu Table
<li class="current">
<a href="House.aspx?H_name=all">Furniture</a> <ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>
<li><a href="Houseaspx?H_name=<%#Eval("H_name") %>"><%#Eval("name") %></a> </li>
</ItemTemplate> </asp:Repeater> </ul> </li>
And in House.aspx page i bind repeater from HOuse_p table subset column
<ul> <asp:Repeater ID="rptMenuE" runat="server">
<ItemTemplate>
<li><a href="House.aspx?subset=<%#Eval("subset") %>">
<%#Eval("Subset") %></a> </li>
</ItemTemplate>
</asp:Repeater> </ul>
When users click on menu item in index.aspx menu it go to house.aspx and bind datalist according to H_name column from House_p table
This is code
private void GetCustomersPageWise(int pageIndex) {
{
if (Request.QueryString["H_name"] != "all") {
using (SqlCommand cmd = new SqlCommand("GetCustomersPageWise1", _cn)) {
string BehCode = Request.QueryString["H_name"];
[Code] ....
Now I want when users click on menu item in House.aspx page it bind datalist from House_p table according to Subset column .. How I can do it ?
View 1 Replies
May 13, 2010
I have access to two servers, one with my development database on, and another with the live database on.
All SQL Stored Procedures, Functions, Views are encrypted on the live database (using WITH ENCRYPTION in my query)
However I'm concerned I might accidentally encrypt a bunch of SProcs on my development database meaning I can no longer view/edit that code.
I have full control over the server and database, and was wondering if there is a way I can prevent these from being encrypted, therefore throwing up an error when this is attempted?
View 4 Replies
Apr 27, 2010
I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.
When I configure the datasource, I choose my connection string which looks like this in my webconfig:
<connectionStrings>
<add
name="PSFSPRD_ConnectionString"
connectionString="Data
The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.
On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.
I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.
Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?
View 3 Replies
Mar 15, 2011
I created two stored procedures in SQL Server Management Studio.
First procedure add field in ProjcetsToUsers table (for many-to-many associations)
[code]....
I can delete the user from the project and then add another, and the new one is added but removed the remains.
As for data base both this function work correctly.
View 1 Replies
Jun 17, 2010
Again, I am new to the ASP.NET world, and I come from a Windows Forms background. I'm working with an ObjectDataSource that retrieves a collection of business objects. With the collection, I am going to be binding it to a CheckBoxList and other various controls. The business object that I am using is an Employee.
To get all of the employees, I create an ObjectDataSource and set the "Select" method. I then set the DataSourceID of the CheckBoxList to be that of the ObjectDataSource. When I load the page for the first time, I see all of the employees. Now, the user goes through this page and selects all the employees they want to see information about (by checking the box next to the employee name). Finally, the user hits the button called "Display." Upon postback how do I get a list of those employees? I've tried the following solution, but I'm not sure if it's the best practice in obtaining all those employees again. Here's my solution...
In the CheckBoxList, I set the DataTextField to the Employee's name. I also set the CheckBoxList's DataValueField. This property is a little different. I set this to be a UNIQUE IDENTIFIER, which can distinguish this employee from other employees. Now, when the user hits the button "Display" I use my ObjectDataSource again and MANUALLY call ObjectDataSource.Select(). I cast the returned value as a List<Employee>. Finally, I iterate through all list items in the CheckBoxList...
[Code]....
If the item is selected, I parse through my list of employees that was returned from the bjectDataSource.Select(). I use the item.Value and compare it to each employee's "key." If the key is found, I know that the employee is selected. I put this employee in another list called EmployeesSelected.
Finally, I take EmployeesSelected (which is a List) and set my GridView's .DataSource and call .DataBind() on the GridView.
Is this the "best practice" of re-obtaining the Employees that are selected on my page, or am I making this too complicated?
View 1 Replies
Aug 7, 2010
I used to be a software tester. I am a little bit familiar with stored procedures from client-server apps. My understanding is that they are on a server (where they operate more efficiently than if they were a module of code on a client machine) and they are used to modify the database.
Can anyone give me information a nutshell about stored procedures and when to use them?
View 2 Replies
Jun 30, 2010
Currently I am working on a project at work that deals with MVC. I have never used MVC before, only dealt a little with ASP with VB, and that's it. I've dabbled in HTML but not much. I don't currently have the money for a book, so I'm using this forum. So there's a lot of jargon I may not pick up on or may ask a lot of questions, so please bare with me.Anyways here's what I would like to do, or understand. We're using ASP.NET Membership Security (not sure if that's what it's actually called) for passwords and accounts. My issue is that I've been working on other projects while the rest of my team has been working on this, so they know more about it than I do. And I don't want to take too long to understand it, but I have to find the best way to make sure the following doesn't happen:
1) When changing a password, it can't be within the last 10 passwords used for that user.2) When creating/changing a password, it cannot have dictionary words, names, phone numbers or personal data within it.3) The password must be a minimum of 16 characters.Number 3 is rather easy and completed I believe. However, 1 and 2 prove tenuous. We want to store the previous passwords hashed and we were going to save the salt used. However, I'm beginning to think that with the Membership class you can't specify the salt to hash a password. Is there a way to de-hash a password? We do not want to store the passwords as plaintext, so that is out of the question.I believe the best order (for 1 and 2) is to do 2 first (before it's hashed) and then 1. For two, I need to know how to call a function in the Model code from a <submit> tag in the View code. I've done a little research online but thought I'd ask and see if it gets answered while I'm looking for the answer.
In general, my questions are:1) How do I call a function in the ****Model.cs from a <submit> tag in the *******.aspx?2) What's the best way to compare previous passwords that are hashed? 3) If I know the salt, can I de-hash a password? (I believe the answer to this is no.)4) Can I specify the salt to hash a password? (I believe the answer to this is no.)5) If #3 and #4 are no, then should I do encryption instead of hashing?Details: MVC2, C#, Membership.
View: Account/ChangePassword.aspx
[Code]....
Model: AccountModel.cs
View 16 Replies
Jul 12, 2010
I've a static page method in web form application and I want to call method on private class level variable from it as shown below. I'm using jQuery to call the page method.
private readonly ICatalogBLL _catalogBLL = new CatalogBLL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
_catalogBLL.GetSomething();
}
}
[WebMethod]
public static UpdateSomething(int i)
{
//Want to do as below. But can't call it from a static method.
_catalogBLL.UpdateSomething();
}
UPDATE If I call it as said by John Saunders, won't it use the same instance for requests from different users as it is within a static method?
View 2 Replies
Aug 19, 2010
I'm a novice @ asp.net and in fact any dynamic website building as I'm normally the dba behind the scenes, however, circumstances arise and now I'm looking at the front end, so forgive me if my question seems so obvious or badly worded, it's only day 2 of the .net environment for me.
I have a stored procedure with several parameters (11) that I have written & tested on the server.
I am trying to call it on a web form (using visual web developer 2008 express)
I have created the text boxes & drop downs on the form.
Added a gridview table connected to my stored procedure (which then works on testing) (parameters set to control & picked from the dropdown of form boxes to match).
there is also a submit button. (no coding added) just dragged on page.
Like i said when I test the connection for the gridview of the stored procedure it works, however on the web face it doesn't. I put in the parameters click the submit button and the screen refreshes, i get done @ the bottom but no results. I tried just using the sql and got the same result. I've looked at books but can't see what I'm missing, although, i suspect the onclick event of my submit button.
View 16 Replies
Nov 18, 2010
I've been working on an upgrade for an app that's currently online.
I copied the database to my development server, have been making upgrades to the db (new tables, additional stored procedures, functions, etc). The new upgraded db is now complete and ready to go back online. I developed a script for all the new tables as I created them.
Basically this new db will go with the new upgraded app at a new domain.
So my plan is this...
Copy my existing db (the original) over to the new server.Run the script I developed on my development server to upgrade the new db to the latest version. Take the original db offline once the new one is running. However when I developed the new sps and fcns I didn't script them like I did for the tables (ooops! not thinking), and I have about 100 new sps. Is there anyway to script all the sps in one hit, so that I can run one script to upgrade the new db?
Or do I have to script them individually?
View 2 Replies
Sep 16, 2010
writing vb.net classes based on a MS Sql Stored procedure. So, here's my question.....Is there some kind of tool out there that will generate a class based on a stored procedure. So, for example, the tool can read a Stored Procedure like below:
[Code]....
View 5 Replies
Mar 29, 2010
Im new to ASP.NET (Normally use PHP), and im currently designing a website in VB.NET and SQL Server.
When using LINQ to SQL i know that it uses parametarized queries and we dont need to add them.
So do we need to use Stored Procedures in LINQ (for security reasons)???, If yes How
View 3 Replies
Jan 27, 2010
I'm totally new to MVC (started this morning), and am totally at a loss where to start. I need to rebuild an existing website. I already have a SQL Server 2005 database with tables and stored procedures. In the old version of the website, I built a function to call stored procedures and return the results as a datareader in VB.Net.
I want to use ASP.NET MVC with C#.
The first question I have is: Where would I put the code for the function that calls stored procedures ?
My second question is: Where do I go from there? I just need to get a sense of the basic way to handle presenting a dynamic website. I just want to start out with a Site.Master and display my menus which need to be generated dynamically from my database. I've been googling all day and I haven't really found any posts which answer all of my questions.
View 4 Replies
Aug 26, 2010
I'm using Linq to Sql to call some stored procedures for more complex work; is there any way Linq to Sql can tell me when the output columns from the stored procedure do not match the properties of my entity object? It seems that Linq to Sql tries its best to match the columns and ignores any mismatches.
View 8 Replies
Sep 20, 2010
I am using .net framework 3.5 and sql server 2008.
In my project coding, I want to call stored procedures in sql server 2008.
return value is the object list which references the entity.
But I have the questions.
If in the entity named as "order", is it matching the properties or created through entity constructor??
In my case, I have two properties and one constructor which match one property.
public class orders
{
orders ( string orderid)
{
this.orderid=orderid;
}
public string orderid {get;set;}
public string orderno{get;set;}
}
View 1 Replies
Feb 2, 2011
I need to retrieve data from a stored procedure, but not from a reader. I need to insert and read to see if there is an error code returned so I can Display It
[Code]....
This inserts data into a stored procedure, since I have a promotion going on, I want to check to see if anyone has tried to create several accounts to try to be Customer #100 or so on, I have achieved this in the procedure, and set RETURN @ErrorCode = 1
Have I Set up the SqlParameter Correctly, or do I now have to declare a direction for each parameter?
I have had problems reading from Stored Procedures and Tutorials Seam Straightforward, but thay are about readers only not Input Output
View 3 Replies
Sep 2, 2010
i am calling stored procedure through entity model like result=ctx.spname(parmas), i am expecting 0 or 1 as a result after the execution of sp, but its returning unknown values like 178 for number records.
View 2 Replies
Mar 11, 2011
I am inserting records using stored procedures in LINQ to SQL in MVC.but i don't know the proper way.
View 1 Replies