
-
18,694 point All-Star
-
raghav_khunger
- Member since 08-18-2008, 8:25 AM
- Delhi, India
- Posts 3,449

|
Hi,rock
As I hve not comlete data of urs I have Tested With below example for ur case
It is working for me
Ucan Add Try catch Block To see that is there any exception causing
I have checked with below example
In sql
GO
CREATE TABLE [dbo].[SR_Table](
[id] [int] IDENTITY(1,1) NOT NULL,[UserName] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ON [PRIMARY]
GO
Alter Proc Insert_SR_Table
@Open_Date varchar(50),
@UserFullName nvarchar(50),
@UserName nvarchar(25),
@UserEmail nvarchar(50),
@ServiceRequestType nvarchar(25),
@ServiceRequestSubType nvarchar(25),
@ServiceRequestSubType2 nvarchar(25),
@Descr nvarchar(255),
@Dept_Name nvarchar(50),
@Status_Type nvarchar(25),
@Priority_Name nvarchar(25),
@ManagerDecision nvarchar(25),
@AssignedToName nvarchar(25),@newID int output
as
begin
insert into SR_Table
( UserName)
values
( @UserName )
--INSERT INTO ServiceRequest_Table
--
--(Open_Date,
--
--UserFullName,
--
--UserName,
--
--UserEmail,
--
--ServiceRequestType,
--
--ServiceRequestSubType,
--
--ServiceRequestSubType2,
--
--Descr,
--
--Dept_Name,
--
--Status_Type,
--
--Priority_Name,
--
--ManagerDecision,
--
--AssignedToName)
--
--VALUES (GETDATE(),@UserFullName,@UserName,@UserEmail,@ServiceRequestType,@ServiceRequestSubType,@ServiceRequestSubType2,@Descr,@Dept_Name, @Status_Type, @Priority_Name, @ManagerDecision, @AssignedToName);
SELECT @newID = SCOPE_IDENTITY()
end
In aspx
<html xmlns="http://www.w3.org/1999/xhtml">
< head runat="server"><title>Untitled Page</title>
</ head>
< body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="CreateSRDataSource" runat="server" ConnectionString="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
InsertCommand="Insert_SR_Table" InsertCommandType="StoredProcedure">
<InsertParameters>
<asp:Parameter Name="Open_Date" Type="DateTime" Direction="Input" />
<asp:ControlParameter ControlID="lblIdentity" Name="UserFullName" PropertyName="Text"
Direction="Input" />
<asp:ProfileParameter Name="UserName" PropertyName="Username" Type="String" Direction="Input" />
<asp:ProfileParameter DefaultValue="" Name="UserEmail" PropertyName="EmailAddress"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblSRType" DefaultValue="" Name="ServiceRequestType"
PropertyName="Text" Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblSRSubTypeOne" Name="ServiceRequestSubType" PropertyName="Text"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblSRSubTypeTwo" Name="ServiceRequestSubType2" PropertyName="Text"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="txtBody" Name="Descr" PropertyName="Text" Type="String"
Direction="Input" />
<asp:ProfileParameter DefaultValue="" Name="Dept_Name" PropertyName="Department"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblStatus" Name="Status_Type" PropertyName="Text"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblPriority" Name="Priority_Name" PropertyName="Text"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblManagerDecision" Name="ManagerDecision" PropertyName="Text"
Type="String" Direction="Input" />
<asp:ControlParameter ControlID="lblAssigned" Name="AssignedToName" PropertyName="Text"
Type="String" Direction="Input" />
<asp:Parameter Name="newID" Type="Int32" Direction="Output" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Label ID="lblIdentity" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblSRType" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblSRSubTypeOne" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblSRSubTypeTwo" runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="txtBody" runat="server"></asp:TextBox>
<asp:Label ID="lblStatus" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblPriority" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblManagerDecision" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblAssigned" runat="server" Text="Label"></asp:Label>
<br />
<asp:Label ID="lblError" runat="server" Text="Label"></asp:Label>
</div></form>
</ body>
</ html>
in web config <profile defaultProvider="AspNetSqlProfileProvider">
< properties><add name="UserName" type="String" defaultValue ="Test"/>
< add name="EmailAddress" type="String" defaultValue ="Test"/><add name="Department" type="String" defaultValue ="Test"/><add name="EmailAddress" type="String" defaultValue ="Test"/>
</ properties>
</ profile>
inaspx.vb
Imports System.Data
Imports System.Data.SqlClientPartial Class Default3
Inherits System.Web.UI.PageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
CreateSRDataSource.Insert() Catch ex1 As SqlException
lblError.Text = ex1.Message Catch ex As Exception
lblError.Text = ex.Message
End TryEnd Sub
Protected Sub CreateSRDataSource_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles CreateSRDataSource.Inserted
Dim newID As Integer = Convert.ToInt32(e.Command.Parameters("@newID").Value)End Sub
End Class
Raghav CodeASP.NET Community | My Blog | jQuery Intellisense in Visual Studio 2008 "Success doesn't come to you…you go to it."--Marva Collins "Failure is success if we learn from it." Malcolm Forbes "Success does not come to those who wait . . . and it does not wait for anyone to come to it." Anonymous
|
|