DataSource Controls :: .net Call To A Sql Server Proc?
Jul 7, 2010
I have a .net 3.5 page that calls a short sql server procedure which compiles fine. When the code is called
from a webpage(.net) it runs the first time it is executed. However on the second time it throws an error saying "There is already an object named 'strPKHoldUp' in the database." StrPKHold is a variable that I
declare in the code as seen below.... I have never had a problem before with declaring a variable and having it "save or cache" in the database so you can use it again. Any idea how to solve this? I tried
moving the DECLARE statement around a little bit but that didnt. I changed the variable name to something else and it works one time but fails after that...
[Code]....
View 2 Replies
Similar Messages:
Jan 7, 2011
I have a recordset in a gridview that comes from an outer joint that creates null values in the recordsetWhen I write to the database using stored proc defined in datasource I get dbnull error.I'm trying to process the onDeleting event in the code behind but don't know what to write or if that's the best wayI need to call a stored proc and if the last parameters value is null then the stored proc does one thing, if it's no null it does something else.However DBNull doesn't ssem to be working.
View 1 Replies
Mar 18, 2010
I have made a simple stored proc which include Transaction through which I have to delete records from two tables EmpDetail and EmpDept . EmployeeId is PK in EmpDetail and FK in EmpDept. Procedure has been executed but on doing exec DelEmployee @EmployeeID='e07' showing 0 rows affected..
[Code]....
View 6 Replies
Jul 2, 2010
I've been self teaching SQL and asp.net and i'm a little stuck. I have a stored proc for the insert and then in my Insert inside my class it's not returning the ID after the insert as I am receiving an error message that NULL value has cannot be inserted. I want to add default values to a seperate table after the insert. I will provide my code below, if anyone can help me why the value is not going across?
[Code]....
View 7 Replies
May 31, 2010
i have one table and structure of table is like.Now i need to fetch the Resturant Name and status of Resturant ( whether it is closed or open by comparing the opening time and closingTime with currentTime).
View 6 Replies
Feb 2, 2010
This is the sproc
ALTER Procedure [dbo].[spGetGroupDetails]
(
@inUserID Varchar(15),
@inGroupID numeric=0,
@inGroupName varchar(100) = null
)
As
[Code]....
View 2 Replies
Feb 5, 2010
I am Developing A Application . I want to develop this Application with Linq and used Stored proc in linq Plz give me Some suggestion How we used And If You Have Some Related Topic
View 1 Replies
Apr 15, 2010
can i set the table name in stored proc at runtime ..
sp_MyStoredProc
@Tablename varchar(25)
AS
BEGIN
like select * from @Tablename
END
is it possible...
View 2 Replies
Jul 28, 2010
i have two stored procs. when th 1st stored proc runs i want to be able to use this value returned from the stored into another stored proc.
my first stored proc is:
[Code]....
which returns [Transfer_stations_Authority_name] = 'Blackpool'
now i want to use this value into my second stored proc@
[Code]....
[Code]....
View 1 Replies
Apr 22, 2010
lets say i have check box list like that
Cairo
Alex
Aswan
All
each of them is a check box inside this check box list and i have a stored proc that takes paramter which is the name of the city and gives me a data according to the name of the city (Filter). i wana know if i checkec more that one city how can i pass this to the stored proc eg if i checked on cairo and alex what can i do to make the filter looks like this where city Like 'Cairo' and City Like 'Alex' My Stored Proc takes @City Parameter like this Create Proc xx(@City varchar(2)) how can i pass the 2 cities 2 the stored proc
View 6 Replies
Jan 1, 2011
I have int datatype declared in my store proc.
When I try to pass parameter from code behind in sqldatasource as :
SqlDataSource3.SelectParameters.Add(ContactNum",
System.TypeCode.Int32,
"1")
I get error "
Error converting data type nvarchar to int. "
View 3 Replies
Mar 29, 2010
i'm a total newbie with asp.net mvc and here's my jam:
i have a 3 level list box which selection on box A shows options on box B and selection on box B will show the options for box C.
I'm trying to do the whole thing in asp.net MVC and what i see is that the nerd dinner tutorial uses the ORM method.
so i created a dbml to the database and drag the stored proc inside. i create a datacontext object but i don't quite know how to connect the result from the stored proce which should be multiple rows of data and make it into a json. so i can keep all the json data inside the html page and using jquery i could make the selection process faster. i don't expect the data inside the three boxes to change so often thus i think this method should be quite viable.
Questions:
So how do i get the stored proc part
to return the data as json?
i've noticed some tutorial online
that the json return result part is
at the controller and not at the
model end.
Why is that?
Edit
FYI, i find what i mostly wanted to do here.
For the json part, i referenced here.
View 1 Replies
Aug 3, 2010
i have the following stored proc that inserts data into a database based on a stauts field. the first stored proc inserts into the first table and i am trying to get the identity field out as i need this value for the next stored proc. the first stored proc works fine and inserts the data but the secnd one doesnt, even though there is data there.
[Code]....
View 3 Replies
Oct 28, 2010
I have a table with two indexes, PK_WClient (clustered) and SMonths (non-unqiue, non-clustered), we have a data import that works on the .net side, it imports data via C# into the table. Every time we complete the import the sections of the asp.net site that use that table are very slow, just when pulling the new records, old records are fine. so we reindex that table for both indexes and things are fine again. Rather than us having to reindex manually in sql server 2005 each time, is there a way to get this to happen via a stored proc or from the c# side? this way when the client gets the project, we don't need to run the index, they can just use the site to import data and behind the sceens the reindex can happen once the import is done.
View 4 Replies
Mar 16, 2011
I have written a stored proc for raise error.Whenever a customer checks for a record in the DB that doesn't exist in the DB he has to get an error displayed.I have written a stored proc help me on it i know it is wrong suggest me the correct one.
[Code]....
View 5 Replies
Jul 27, 2010
i am trying to write a stored proc that takes data from one table based on a field in that tabke and writes that data out to another table with the eventual idea that this data is deleted from the original table it was read from. my stored proc is as follows:
[Code]....
but i keep getting an error: incorrect syntax near 'BACKUP_TWS_Waste_Colection_Request'.
View 8 Replies
Mar 9, 2011
I hope to one day figure this looping records from a table to update it, but i cannot get this to complie, I guess cause I am not
versed in looping in sql yet :(
[Code]....
I just want to get data from a table per record run the stored procedure(i have nesting on) and update the record's fields with the values that were returned from the Store procedure. The Stored procedure is working fine.
View 6 Replies
Dec 16, 2010
I'm converting Active X code in DTS to Script Task for SSIS and I'm having trouble creating an XML file from my stored proc. Here's the code:
[Code]....
It throws an error on the dataAdapter fill saying:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '<'.
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '<'.
Msg 132, Level 15, State 1, Line 5
The label 'sql' has already been declared. Label names must be unique within a query batch or stored procedure.
View 6 Replies
Nov 2, 2010
Is it possible to call 1 Stored procedure from another withing a sql query
sp1 :
select ID1,ID2,ID3,ID4 from table1 ;
sp2 :
select name from table2 where ID = ID1;
I want to get corresponding names of ID1,ID2 and ID3,ID4 in sp1 as a query result.Is it somehow possible to call sp2 from sp1?
View 10 Replies
Sep 17, 2010
I have a GridView sourced by a SQL Server stored procedure with several databound fields, including a money column for item values. My stored proc returns the data through a SELECT and everything looks good. The stored proc also has a single output parameter that sums the total value of the displayed data, and this value is displayed in a label above the GridView.
View 7 Replies
Feb 10, 2011
I have to write stored proc to get the daily transaction for a specified date. Right now what i do is everytime i log a transaction in table3 I update table 2 with the count. Then i use table 2 to write the stored proc and to get the desired result. I have pasted my stored proc below with the output. My problem is when another subsystem is added in the AppInfo table i need to update my stored proc because i have hardcoded the subsystem name.
[Code]....
View 4 Replies
Aug 1, 2010
I have a stored proc. that returns the USL & LSL values for each of the 8 different Metrics. say, Defect Density (Upper Specification Limit) USL = 0.30 & Defect Density (Lower Specification Limit_ LSL = 0.05). Simillarly for 8 different Metrics. Why I need these Spec. Limits ?...Because I want o compare my project's Metrics Value displayed in the Grid View with the corresponding USL & LSL value of the same Metrics. IF Metrics Value is outside of USL & LSL Then I want to Mark the Metrics in Red Color.
1. STORED PROC "Get_Spec_Limits" Does Not Return Anything
2. Error : Object Reference Not set to an Instance of an Object, in the following "OnRowDataBound' Event
OnRowDataBound="GridView1_RowDataBound"
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim strConnection As String = "Data Source=******;Initial Catalog=Metrics;Integrated Security=True"
Dim objConnection As New SqlConnection(strConnection)
Dim da As New SqlDataAdapter("Get_Spec_Limits", objConnection)
da.SelectCommand.CommandType = CommandType.StoredProcedure
Dim Productivity_USL As New SqlParameter("@Productivity_LSL", SqlDbType.Float)
Dim Productivity_LSL As New SqlParameter("@Productivity_LSL", SqlDbType.Float)
Dim IDD_LSL As New SqlParameter("@IDD_LSL", SqlDbType.Float)
Dim IDD_USL As New SqlParameter("@IDD_USL", SqlDbType.Float)
Dim EDD_LSL As New SqlParameter("@EDD_LSL", SqlDbType.Float)
Dim EDD_USL As New SqlParameter("@EDD_USL", SqlDbType.Float)
Dim DRE_FS_LSL As New SqlParameter("@DRE_FS_LSL", SqlDbType.Float)
Dim DRE_FS_USL As New SqlParameter("@DRE_FS_USL", SqlDbType.Float)
Dim DRE_TS_LSL As New SqlParameter("@DRE_TS_LSL", SqlDbType.Float)
Dim DRE_TS_USL As New SqlParameter("@DRE_TS_USL", SqlDbType.Float)
Dim DRE_Code_USL As New SqlParameter("@DRE_Code_USL", SqlDbType.Float)
Dim DRE_Code_LSL As New SqlParameter("@DRE_Code_LSL", SqlDbType.Float)
Dim COQ_USL As New SqlParameter("@COQ_USL", SqlDbType.Float)
Dim COQ_LSL As New SqlParameter("@COQ_LSL", SqlDbType.Float)
Dim COPQ_USL As New SqlParameter("@COPQ_USL", SqlDbType.Float)
Dim COPQ_LSL As New SqlParameter("@COPQ_LSL", SqlDbType.Float)......................
View 4 Replies
Mar 29, 2011
I've modified an existing strored procedure. It originally had one ouput parameter in the stored proc and it was set up as follows in the c# code that called it:
cmd.Parameters.Add("@Var1Param", SqlDbType.BigInt);
if (Var1 == 0)
cmd.Parameters["@Var1"].Value = DBNull.Value;
else
cmd.Parameters["@Var"].Value = Var1;
cmd.Parameters["@Var1"].Direction = ParameterDirection.InputOutput;
cmd.ExecuteNonQuery();
// Get Var1
Var1= dataMorph.ToInt64(cmd.Parameters["@Var1"].Value.ToString());
Just to clarify, this parameter was declared as OUTPUT in the stored proc but as inputoutput in the C# code. This worked fine. I have added another parameter to the same stored procedure and I want to retrieve both from the C# code. The C# code now is as follows:.................................
View 3 Replies
Jul 23, 2010
How to export binary data from table to filesystem via stored proc
View 2 Replies
Sep 3, 2010
I need to get IIS Logfile data from Stored Proc. How to do this. I am using Bulk Insert Method in my stored Proc When I execute the stored proc I am getting an error that
[Code].....
View 5 Replies