I have stored procedure in sql server as follows - USE [KHHAPS1]
-
GO
-
/****** Object: StoredProcedure [dbo].[sp_transcrt] Script Date: 09/30/2014 16:22:48 ******/
-
SET ANSI_NULLS OFF
-
GO
-
SET QUOTED_IDENTIFIER OFF
-
GO
-
-- Used to Create the HAPSTran Table By copying All Required fields from HAPSMast Table
-
-- @YrMn contains the present YearMonth value
-
create PROCEDURE [dbo].[sp_transcrt]
-
@YrMn as char(6),
-
@TypeInst as varchar(6),
-
@User as varchar(3),
-
@Cnt as int OUTPUT as
-
declare @TTableName as Char(11)
-
select @TTableName='TT' + @TypeInst+@User
-
declare @m1 as int
-
declare @YrMn2 as char(6)
-
select @m1=convert(int,right(@YrMn,2))
-
if @m1=1
-
begin
-
declare @y1 as int
-
select @y1=convert(int,left(@YrMn,4))
-
select @y1=@y1-1
-
select @YrMn2=CONVERT(CHAR(4),@y1)+'12'
-
end
-
else
-
begin
-
select @m1=@m1-1
-
declare @mm as char(2)
-
if @m1<10
-
select @mm='0' + convert(char(1),@m1)
-
else
-
select @mm= convert(char(2),@m1)
-
select @YrMn2= left(@YrMn,4)+@mm
-
end
-
insert HAPSTran(InstId,EmpCode,Yrmn,DeptCode,UnitCode,HapsCat,Basic,Basic35,SpfAmt,Mhap,Haps3,Short,Incentive,Eligible,EveAct,EveElg,Arrears,Gross,Tds,Deduction,Net,HAPS,Variable,AGP,hapsperc,userid,Datem,timem,Moddate,Moduser) select @TypeInst,EmpCode,@YrMn,DeptCode,UnitCode,HapsCat,Basic,0,PLI,0,0,0,0,0,0,0,0,0,0,0,0,'Y',Variable,AGP,HapsPerc,@User,getdate(),null,null,null
-
from HAPSMast where active <> 'N' AND HAPSMast.InstId = @TypeInst
-
UPDATE HAPSTran
-
SET basic35 = ROUND((b.basic+a.AGP) * (cast(a.NPAPerc as float) / CAST(100 AS FLOAT)),0) from HAPSMAST a INNER JOIN HAPSTran b ON A.Empcode = B.Empcode AND A.InstId = B.InstId where b.yrmn = @Yrmn AND A.InstId = @TypeInst AND b.InstId = @TypeInst
-
UPDATE HAPSTran
-
SET WDays = (select nodays from hapscutoff ) where unitCode='ANS001' and yrmn = @Yrmn
-
-
UPDATE HAPSTran
-
SET WDays = 0 where unitCode <> 'ANS001' and yrmn = @Yrmn
and I want to call this in vb.net. please send the source code
1 1470 Frinavale 9,735
Recognized Expert Moderator Expert
Use the SqlConnection class to open a connection to your database and use the SqlCommand Class to execute a command that calls your stored procedure.
For example: -
Dim connectionString As String = "Server=ipOfSQLServerHost;Database=DatabaseName;User ID=userID; Password=theDatabasePassword;" 'your specific connection string needs to go here
-
Dim queryString As String= "sp_transcrt"
-
Dim output As String
-
-
Using connection As New SqlConnection(connectionString)
-
-
Dim command As New SqlCommand(queryString, connection)
-
command.CommandType = CommandType.StoredProcedure
-
-
command.Parameters.Add("@YrMn", SqlDbType.VarChar, 6)
-
command.Parameters.Add("@TypeInst", SqlDbType.VarChar, 6)
-
command.Parameters.Add("@User", SqlDbType.VarChar, 6)
-
command.Parameters.Add("@Cnt", SqlDbType.VarChar)
-
command.Parameters("@Cnt").Direction = ParameterDirection.Output
-
-
command.Connection.Open()
-
-
Dim numRows As Integer = command.ExecuteNonQuery()
-
If IsDBNull(command.Parameters("@Cnt").Value) = False Then
-
output = command.Parameters("@Cnt").Value
-
End If
-
-
End Using
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Luis |
last post by:
I'm using code similar to the following in an asp page to call a
stored procedure that does a select on a SQLServer 2000 table:
dim rs, SelectSql
SelectSql = "EXEC spSelectStuff @param = '" &...
|
by: syoung |
last post by:
I would like to know if anyone knows how to execute a stored procedure from
ASP.NET 2.0. I'm using the NorthWind database and I'm trying to execute the
"CustOrderHist" stored procedure. The...
|
by: Jenny C. |
last post by:
Hi
I am fairly new to .NET, and I am having a hard time to call a stored procedure from C# code in a windows application
I have tested my connection (and login) several time and it is OK. If I...
|
by: Sam |
last post by:
I had created stored procedure at SQL Server 2000 and how do I call it via
ASP.Net using VB Language?
CREATE PROCEDURE STK As
if exists (select * from dbo.sysobjects where id =...
|
by: sarma |
last post by:
Hi friends,
I created a stored procedure in MySQL like
create procedure p()
select NOW();
I write a C program, from which i wish to call this stored procedure, i used both...
| |
by: JM |
last post by:
Hi,
I am using SQL Server 2000 and ASP.NET 2.0 and want to call a stored
procedure using Latest Enterprise Library 2.0. My stored procedure has
3 input parameters: CustId (int), RefId(int) and...
|
by: eholz1 |
last post by:
Hello PHP Group,
Is there any advantages (or disadvantages) in using mysqli instead of
mysql (querys, connections to database, etc).
I am currently using mysql_connect, and things like this:...
|
by: pbaillard |
last post by:
Here a sample to call a stored procedure with an Oracle Database.
odc.Connection = m_cDb ' use an open connection to your database
odc.CommandType = CommandType.StoredProcedure
odc.CommandText =...
|
by: E11esar |
last post by:
Hello there.
I am going in bit of a circle with this matter;
First some background: I am trying to upload the details of a CSV file into an Oracle table. I am using a StreamReader to copy a line...
|
by: akashazad |
last post by:
Hi Friends
My question is "can we call Stored Procedure from a User Defined Function in SQL"
If yes then pl tell me how?
If No then pl tell me why not ?
While I was trying finding...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |