the function that I have in the postgres database has the following signature...
-------------------
CREATE OR REPLACE FUNCTION su_employee(empname character varying, empcode character varying, empaddress character varying, employeeid integer)
RETURNS integer AS
------------------
I am using pgsqldatasource, by setting
------------
UpdateCommand="su_employee" UpdateCommandType="StoredProcedure"
-------------
but when I go to edit the row, it comes up with a weird error.
-----------------
function su_employee(unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Devart.Data.PostgreSql.PgSqlException: function su_employee(unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) does not exist
----------------
Observe..Observe... my function had only 4 parameters... WHY DOES THE ERROR MESSAGE SHOW that MY FUCTION has 8 parameters... I don't understand...!!!
-------
helper...
_____
CREATE OR REPLACE FUNCTION su_employee(empname character varying, empcode character varying, empaddress character varying, employeeid integer)
RETURNS integer AS
$BODY$
UPDATE employee set employeename=$1,employeecode=$2,employeeaddress=$3 WHERE employeeid=$4;
SELECT $4 as updatedemployeeid;
$BODY$
LANGUAGE 'sql' VOLATILE
COST 100;
-------------------
' />
' />
' />
' Width="100" />
' Width="100" />
' Width="150" />
' Width="40" />
------------------------------
"
DeleteCommand="sd_employee" DeleteCommandType="StoredProcedure"
InsertCommand="si_employee" InsertCommandType="StoredProcedure"
OldValuesParameterFormatString="Original_{0}"
ProviderName=""
SelectCommand="sp_employee" SelectCommandType="StoredProcedure"
UpdateCommand="su_employee" UpdateCommandType="StoredProcedure"
CancelSelectOnNullParameter="False">
PgSqlDataSource UPDATE Command not working with stored proc
-
- Posts: 4
- Joined: Thu 24 Sep 2009 00:38
-
- Posts: 4
- Joined: Thu 24 Sep 2009 00:38
Solved it!
PgSqlDataSource automatically understands what parameters need to be sent for the UPDATE Command, because I have used "Bind()", which is a two way data communicator.
When the UPDATE command is issued, the PgSqlDataSource automatically includes the primary key field as the original_{0}, so you may have to remove the primary key field by yourself....and how will you remove it??? Look at the following code.
I may not have explained this very well. You are welcome to ask me any questions related to this.
Thank You.
When the UPDATE command is issued, the PgSqlDataSource automatically includes the primary key field as the original_{0}, so you may have to remove the primary key field by yourself....and how will you remove it??? Look at the following code.
Code: Select all
Protected Sub PgSqlDataSource1_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles PgSqlDataSource1.Updating
Dim indexParam As Integer = 0
Dim isFound As Boolean = False
'search for the problem additional parameter which is added automatically by VS
For Each xP As Devart.Data.PostgreSql.PgSqlParameter In e.Command.Parameters
'check if this is the trouble extra parameter
If xP.ParameterName = "employeeid" Then
'this is the problem parameter, set to found and exit the loop
isFound = True
Exit For
End If
'the param wasnt found so increment the index counter
indexParam += 1
Next
'if the parameter was found, remove it from the parameters collection
If isFound = True Then
e.Command.Parameters.Remove(e.Command.Parameters(indexParam))
End If
End Sub
Thank You.
Please give us the following information:
1) the exact text of the error you are getting at the moment;
2) the full call stack;
3) the version of your dotConnect for PostgreSQL. You can see it in the Tools | PostgreSQL | About menu of Visual Studio;
4) please send us ( http://www.devart.com/company/contact.html ) a small test project with the DDL/DML script to reproduce the problem. We will investigate the issue and notify you about the results as soon as possible.
1) the exact text of the error you are getting at the moment;
2) the full call stack;
3) the version of your dotConnect for PostgreSQL. You can see it in the Tools | PostgreSQL | About menu of Visual Studio;
4) please send us ( http://www.devart.com/company/contact.html ) a small test project with the DDL/DML script to reproduce the problem. We will investigate the issue and notify you about the results as soon as possible.