Click here to Skip to main content
15,892,537 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Video Confrence in asp.net Pin
R. Giskard Reventlov7-Jul-10 1:56
R. Giskard Reventlov7-Jul-10 1:56 
Questiondisabled buttons look enabled in firefox and chrome. what to do Pin
sriharsha24107-Jul-10 1:07
sriharsha24107-Jul-10 1:07 
AnswerRe: disabled buttons look enabled in firefox and chrome. what to do Pin
HardikSitapara7-Jul-10 2:16
HardikSitapara7-Jul-10 2:16 
QuestionDataset, Oracle & Filter Pin
AlanRuth7-Jul-10 0:41
AlanRuth7-Jul-10 0:41 
AnswerRe: Dataset, Oracle & Filter Pin
R. Giskard Reventlov7-Jul-10 1:52
R. Giskard Reventlov7-Jul-10 1:52 
GeneralRe: Dataset, Oracle & Filter Pin
AlanRuth7-Jul-10 3:39
AlanRuth7-Jul-10 3:39 
GeneralRe: Dataset, Oracle & Filter Pin
R. Giskard Reventlov7-Jul-10 3:44
R. Giskard Reventlov7-Jul-10 3:44 
QuestionSqlDataSource ERROR: Function or stored procedure has too many arguments passed. [modified] Pin
mominafiz6-Jul-10 22:56
mominafiz6-Jul-10 22:56 
hi,

i m facing problem in gridview updating. I  m using sqldatasource to select and update the record.
In select of sqldatasource i m passing three parameter and in update i m passing 4 parameter. when i run my program, the select in sqldatasource works perfect. but when i update that record...its throws error...
" Function or stored procedure has too many arguments passed". Even though i m getting this error and my page crashes...i m still able to update the record, this i noticed when i stop the program after webpage crash and then run the program again. but i dont want my webpage to crash.



Here is my ASPX file code...
<asp:GridView ID="pattestsGridView" runat="server" CellPadding="2" GridLines="Vertical"
                            AutoGenerateColumns="False" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
                            ForeColor="Black" Width="100%" AutoGenerateSelectButton="True" Font-Size="Small"
                            AutoGenerateEditButton="True" OnRowUpdating="RowUpdating" DataSourceID="SqlDataSource1"
                            AllowPaging="True" AllowSorting="True">
                            <RowStyle BackColor="#EFF3FB" />
                            <Columns>
                                <asp:TemplateField HeaderText="SEND TEST" SortExpression="send_test">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="sendtesttb" runat="server" Text='<%# Bind("send_test") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="sendtestlb" runat="server" Text='<%# Eval("send_test") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="PATIENT ID" SortExpression="PATIENT ID">
                                    <ItemTemplate>
                                        <asp:Label ID="patidlb" runat="server" Text='<%# Eval("[PATIENT ID]") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="TEST ID" SortExpression="TEST ID">
                                    <ItemTemplate>
                                        <asp:Label ID="testidlb" runat="server" Text='<%# Eval("[TEST ID]") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="TEST NAME" SortExpression="TEST NAME">
                                    <ItemTemplate>
                                        <asp:Label ID="testnamelb" runat="server" Text='<%# Eval("[TEST NAME]") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="PRIORITY" SortExpression="PRIORITY">
                                    <ItemTemplate>
                                        <asp:Label ID="prioritylb" runat="server" Text='<%# Eval("PRIORITY") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="DATE" SortExpression="DATE">
                                    <ItemTemplate>
                                        <asp:Label ID="dtlb" runat="server" Text='<%# Eval("DATE") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#CCCC99" />
                            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="false" ForeColor="White" />
                            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" Font-Size="Medium" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
         
   </div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$      ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="PatTestReqSelect;1"
            SelectCommandType="StoredProcedure" UpdateCommand="PatTestReqUpdate;1" 
            UpdateCommandType="StoredProcedure" >
            <SelectParameters>
                <asp:Parameter Name="PatID" Type="String" />
                <asp:Parameter Name="EmpID" Type="String" />
                <asp:Parameter Name="Date" Type="Datetime" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="SendTest" Type="String"  />
                <asp:Parameter Name="PatID"  type="String"/>
                <asp:Parameter Name="TestID" Type="String"  />
                <asp:Parameter Name="Date" Type="DateTime" />
            </UpdateParameters>
        </asp:SqlDataSource>


Here is my VB.net code...

Private Sub searchbtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles searchbtn.Click
        '##################     FOR CONNECTION  ################

        Dim MySearchCon As DbConnection = providerFactory.CreateConnection()
        MySearchCon.ConnectionString = connectionString.ConnectionString

        '###################  END OF CONNECTION ################

        Dim sqlcmd As New SqlCommand
        Dim adptr As New SqlDataAdapter
        Dim ds As New DataSet
        Dim strdt As String = Request.QueryString("dt")
        Dim s As String = Me.pattestpatidtb.Text
        Dim s1 As String = Me.refdocidtb.Text

    If Me.pattestpatidtb.Text <> "" And Me.refdocidtb.Text <> "" Then

       SqlDataSource1.SelectParameters("PatID").DefaultValue = UCase(pattestpatidtb.Text)
       SqlDataSource1.SelectParameters("EmpID").DefaultValue = UCase(refdocidtb.Text)

       If Request.QueryString("Date") <> "" Then
         SqlDataSource1.SelectParameters("Date").DefaultValue = Request.QueryString("Date")
       Else
       SqlDataSource1.SelectParameters("Date").DefaultValue = DateTime.Now.ToString("yyyy-mm-dd hh:mm:ss")
       End If
    End If
End Sub


Protected Sub RowUpdating(ByVal sender As Object, ByVal e As EventArgs) Handles pattestsGridView.RowUpdating

        '##################     FOR CONNECTION  ################

        Dim MySearchCon As DbConnection = providerFactory.CreateConnection()
        MySearchCon.ConnectionString = connectionString.ConnectionString

        '###################  END OF CONNECTION ################

        Dim sqlcmd As New SqlCommand
        Dim adptr As New SqlDataAdapter
        Dim ds As New DataSet

        If pattestsGridView.SelectedIndex < 0 Then
            MsgBox("Please selected the record to update and then proceed.", MsgBoxStyle.Critical)
            Exit Sub
        End If
        Dim uppatid As Label = pattestsGridView.SelectedRow.FindControl("patidlb")
        Dim uptestid As Label = pattestsGridView.SelectedRow.FindControl("testidlb")
        Dim updtlb As Label = pattestsGridView.SelectedRow.FindControl("dtlb")
        Dim upsendtest As TextBox = pattestsGridView.SelectedRow.FindControl("sendtesttb")

        MsgBox("Record successfully updated.", MsgBoxStyle.Information)
        Dim dtlb As Date = updtlb.Text

        Dim dttime As String = String.Empty

        dttime = dtlb.ToString

        Dim strst As String = Nothing
        strst = UCase(upsendtest.Text)


        If Not strst.Equals("Y") Then
            If Not strst.Equals("N") Then
                MsgBox("Please enter either 'Y' or 'N'.", MsgBoxStyle.Critical)
                Exit Sub
            End If
        Else
            'Exit Sub
        End If
        Dim updatecmd As New SqlCommand

        
        //tried this too
        'SqlDataSource1.UpdateParameters.Clear()
        'SqlDataSource1.UpdateParameters.Add("SendTest", UCase(upsendtest.Text)).ToString()
        'SqlDataSource1.UpdateParameters.Add("TestID", UCase(uptestid.Text)).ToString()
        'SqlDataSource1.UpdateParameters.Add("PatID", UCase(uppatid.Text)).ToString()
        'SqlDataSource1.UpdateParameters.Add("Date", UCase(updtlb.Text)).ToString()


        SqlDataSource1.UpdateParameters("SendTest").DefaultValue = UCase(upsendtest.Text)
        SqlDataSource1.UpdateParameters("PatID").DefaultValue = UCase(uppatid.Text)
        SqlDataSource1.UpdateParameters("TestID").DefaultValue = UCase(uptestid.Text)
        SqlDataSource1.UpdateParameters("Date").DefaultValue = dttime

        SqlDataSource1.Update()
    End Sub


My stored Procedure for select statement
CREATE PROCEDURE [dbo].[PatTestReqSelect]
@PatID nvarchar(16),
@EmpID nvarchar(16),
@Date datetime
AS
BEGIN
SET NOCOUNT ON;

     SELECT SchedListTable.send_test,SchedListTable.pat_id AS [PATIENT ID],SchedListTable.test_id 
	AS [TEST ID],TestName.test_name AS [TEST NAME],SchedListTable.prior_lev AS [PRIORITY], 
	SchedListTable.dt AS [DATE] 
     FROM SchedListTable INNER JOIN TestName ON SchedListTable.test_id=TestName.test_id 
        
     WHERE pat_id=@PatID  AND emp_id=@EmpID  AND SchedListTable.dt=@Date
     ORDER BY SchedListTable.dt DESC
END


My stored procedure for Updating the record
CREATE PROCEDURE [dbo].[PatTestReqUpdate]
@SendTest nvarchar(1),
@PatID nvarchar(16),
@TestID nvarchar(8),
@Date datetime
AS

SET NOCOUNT ON
BEGIN

	UPDATE SchedListTable SET send_test=@SendTest
	 WHERE
        pat_id=@PatID AND test_id=@TestID AND dt=@Date
END


modified on Wednesday, July 7, 2010 5:08 AM

AnswerRe: SqlDataSource ERROR: Function or stored procedure has too many arguments passed. Pin
R. Giskard Reventlov6-Jul-10 23:30
R. Giskard Reventlov6-Jul-10 23:30 
AnswerRe: SqlDataSource ERROR: Function or stored procedure has too many arguments passed. Pin
Peace ON6-Jul-10 23:45
Peace ON6-Jul-10 23:45 
GeneralRe: SqlDataSource ERROR: Function or stored procedure has too many arguments passed. Pin
mominafiz9-Jul-10 0:14
mominafiz9-Jul-10 0:14 
QuestionFile Upload Error,ASP.NET Pin
Member 32222646-Jul-10 21:35
Member 32222646-Jul-10 21:35 
AnswerRe: File Upload Error,ASP.NET Pin
R. Giskard Reventlov6-Jul-10 22:31
R. Giskard Reventlov6-Jul-10 22:31 
AnswerRepost Pin
Peace ON6-Jul-10 22:32
Peace ON6-Jul-10 22:32 
GeneralRe: Repost Pin
R. Giskard Reventlov6-Jul-10 22:48
R. Giskard Reventlov6-Jul-10 22:48 
GeneralRe: Repost Pin
Sandeep Mewara6-Jul-10 23:24
mveSandeep Mewara6-Jul-10 23:24 
AnswerRe: Repost Pin
Peace ON6-Jul-10 23:25
Peace ON6-Jul-10 23:25 
GeneralRe: Repost Pin
Sandeep Mewara6-Jul-10 23:27
mveSandeep Mewara6-Jul-10 23:27 
GeneralRe: Repost Pin
Peace ON6-Jul-10 23:29
Peace ON6-Jul-10 23:29 
GeneralRe: Repost Pin
R. Giskard Reventlov6-Jul-10 23:28
R. Giskard Reventlov6-Jul-10 23:28 
GeneralRe: Repost Pin
Sandeep Mewara6-Jul-10 23:33
mveSandeep Mewara6-Jul-10 23:33 
GeneralRe: Repost Pin
R. Giskard Reventlov7-Jul-10 0:30
R. Giskard Reventlov7-Jul-10 0:30 
GeneralRe: Repost Pin
Sandeep Mewara7-Jul-10 0:31
mveSandeep Mewara7-Jul-10 0:31 
Questionmotionless analog clock Pin
Hemant Thaker6-Jul-10 21:06
Hemant Thaker6-Jul-10 21:06 
AnswerRe: motionless analog clock Pin
Sandeep Mewara6-Jul-10 23:30
mveSandeep Mewara6-Jul-10 23:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.