Storing user objects in Session - symfony

I have a User entity. One user can buy a product. After the form validation I want to store the user data (ID, name, mail, password, address, ..) in $session, and only after the success payment retrieve this data from session and store it to the db.
This is what I'm doing: (if the from is valid)
$session = new Session();
$serialized_user = serialize($user);
$session->set('myuser', ($serialized_user));
Then, after the payment check:
$test = ($this->get('session')->get('myuser'));
$test_unserialized = unserialize($test);
$em = $this->getDoctrine()->getManager();
$em->persist($test_unserialized);
$em->flush();
return $this->render('UserBundle:Account:buyedOk.php');
What I got is this error:
An exception occurred while executing 'INSERT INTO user (user, passw, email, is_active, is_locked, date_expire, date_registration, last_visit, name, surname, address, zipcode, city, province, country, vat, tel, fax, contact_name, contact_role, contact_email, contact_tel, email_hex, email_confirmed, validated,id_currency) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["March", "$2y$13$hTBP0ANwRlwgcfX19OtsTubn6ctI64lz5GVQ3JF3nZtD0GDPK8rTC", null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'email' cannot be null
Suggestions?

Related

Ansible: create a dictionary from a register.results var

i have the result variable ( see at the bottom ) from a task (modul community.general.proxmox_kvm) and i want create a new dictionary variable from the items that changed in the result variable.
The structure should look like this
vm_dict:
80001:
host_name: ansible-clone1
host_ip_address: 10.10.0.1
80002:
host_name: ansible-clone2
host_ip_address: 10.10.0.2
What is a good way to accomplish this ? I tryed it with set_fact and combine filter but i get stucked and was not able to put multible values. Also the changed status not worked as expected.
- name: Populate dict
set_fact:
_dict: "{{ _dict|default({}) | combine( {item.item.key: item.item.value.host_name} ) }}"
loop: "{{ provisioning_vm.results }}"
when: provisioning_vm.changed == true
I will be happy for some suggestions.
Here is the result variable ( type list )
TASK [provisioning_proxmox : print var provisioning_vm] *************************************************************
ok: [localhost] => {
"provisioning_vm": {
"changed": false,
"msg": "All items completed",
"results": [
{
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"acpi": null,
"agent": null,
"api_host": "10.0.10.1:8006",
"api_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"api_token_id": null,
"api_token_secret": null,
"api_user": "ansible_admin#pve",
"args": null,
"autostart": null,
"balloon": null,
"bios": null,
"boot": null,
"bootdisk": null,
"cicustom": null,
"cipassword": null,
"citype": null,
"ciuser": null,
"clone": "arbitrary_template",
"cores": null,
"cpu": null,
"cpulimit": null,
"cpuunits": null,
"delete": null,
"description": null,
"digest": null,
"efidisk0": null,
"force": null,
"format": "raw",
"freeze": null,
"full": true,
"hostpci": null,
"hotplug": null,
"hugepages": null,
"ide": null,
"ipconfig": null,
"keyboard": null,
"kvm": null,
"localtime": null,
"lock": null,
"machine": null,
"memory": null,
"migrate_downtime": null,
"migrate_speed": null,
"name": "ansible-clone1.dev.test.com",
"nameservers": null,
"net": null,
"newid": 80001,
"node": "proxmox01",
"numa": null,
"numa_enabled": null,
"onboot": null,
"ostype": null,
"parallel": null,
"pool": null,
"protection": null,
"proxmox_default_behavior": "no_defaults",
"reboot": null,
"revert": null,
"sata": null,
"scsi": null,
"scsihw": null,
"searchdomains": null,
"serial": null,
"shares": null,
"skiplock": null,
"smbios": null,
"snapname": null,
"sockets": null,
"sshkeys": null,
"startdate": null,
"startup": null,
"state": "present",
"storage": "CEPH-DEV",
"tablet": null,
"tags": null,
"target": null,
"tdf": null,
"template": null,
"timeout": 400,
"update": false,
"validate_certs": false,
"vcpus": null,
"vga": null,
"virtio": null,
"vmid": 987654,
"watchdog": null
}
},
"item": {
"key": 80001,
"value": {
"host_ip_address": "10.10.0.1",
"host_name": "ansible-clone1.dev.test.com"
}
},
"msg": "VM with name <ansible-clone1.dev.test.com> already exists",
"vmid": 80001
},
{
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"acpi": null,
"agent": null,
"api_host": "10.0.10.1:8006",
"api_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"api_token_id": null,
"api_token_secret": null,
"api_user": "ansible_admin#pve",
"args": null,
"autostart": null,
"balloon": null,
"bios": null,
"boot": null,
"bootdisk": null,
"cicustom": null,
"cipassword": null,
"citype": null,
"ciuser": null,
"clone": "arbitrary_template",
"cores": null,
"cpu": null,
"cpulimit": null,
"cpuunits": null,
"delete": null,
"description": null,
"digest": null,
"efidisk0": null,
"force": null,
"format": "raw",
"freeze": null,
"full": true,
"hostpci": null,
"hotplug": null,
"hugepages": null,
"ide": null,
"ipconfig": null,
"keyboard": null,
"kvm": null,
"localtime": null,
"lock": null,
"machine": null,
"memory": null,
"migrate_downtime": null,
"migrate_speed": null,
"name": "ansible-clone2.dev.test.com",
"nameservers": null,
"net": null,
"newid": 80002,
"node": "proxmox01",
"numa": null,
"numa_enabled": null,
"onboot": null,
"ostype": null,
"parallel": null,
"pool": null,
"protection": null,
"proxmox_default_behavior": "no_defaults",
"reboot": null,
"revert": null,
"sata": null,
"scsi": null,
"scsihw": null,
"searchdomains": null,
"serial": null,
"shares": null,
"skiplock": null,
"smbios": null,
"snapname": null,
"sockets": null,
"sshkeys": null,
"startdate": null,
"startup": null,
"state": "present",
"storage": "CEPH-DEV",
"tablet": null,
"tags": null,
"target": null,
"tdf": null,
"template": null,
"timeout": 400,
"update": false,
"validate_certs": false,
"vcpus": null,
"vga": null,
"virtio": null,
"vmid": 987654,
"watchdog": null
}
},
"item": {
"key": 80002,
"value": {
"host_ip_address": "10.10.0.2",
"host_name": "ansible-clone2.dev.test.com"
}
},
"msg": "VM with name <ansible-clone2.dev.test.com> already exists",
"vmid": 80002
},
{
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"acpi": null,
"agent": null,
"api_host": "10.0.10.1:8006",
"api_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"api_token_id": null,
"api_token_secret": null,
"api_user": "ansible_admin#pve",
"args": null,
"autostart": null,
"balloon": null,
"bios": null,
"boot": null,
"bootdisk": null,
"cicustom": null,
"cipassword": null,
"citype": null,
"ciuser": null,
"clone": "arbitrary_template",
"cores": null,
"cpu": null,
"cpulimit": null,
"cpuunits": null,
"delete": null,
"description": null,
"digest": null,
"efidisk0": null,
"force": null,
"format": "raw",
"freeze": null,
"full": true,
"hostpci": null,
"hotplug": null,
"hugepages": null,
"ide": null,
"ipconfig": null,
"keyboard": null,
"kvm": null,
"localtime": null,
"lock": null,
"machine": null,
"memory": null,
"migrate_downtime": null,
"migrate_speed": null,
"name": "ansible-clone4.dev.test.com",
"nameservers": null,
"net": null,
"newid": 80004,
"node": "proxmox01",
"numa": null,
"numa_enabled": null,
"onboot": null,
"ostype": null,
"parallel": null,
"pool": null,
"protection": null,
"proxmox_default_behavior": "no_defaults",
"reboot": null,
"revert": null,
"sata": null,
"scsi": null,
"scsihw": null,
"searchdomains": null,
"serial": null,
"shares": null,
"skiplock": null,
"smbios": null,
"snapname": null,
"sockets": null,
"sshkeys": null,
"startdate": null,
"startup": null,
"state": "present",
"storage": "CEPH-DEV",
"tablet": null,
"tags": null,
"target": null,
"tdf": null,
"template": null,
"timeout": 400,
"update": false,
"validate_certs": false,
"vcpus": null,
"vga": null,
"virtio": null,
"vmid": 987654,
"watchdog": null
}
},
"item": {
"key": 80004,
"value": {
"host_ip_address": "10.10.10.4",
"host_name": "ansible-clone4.dev.test.com"
}
},
"msg": "VM with name <ansible-clone4.dev.test.com> already exists",
"vmid": 80004
}
],
"skipped": false
}
}
For example,
vm_dict: "{{ dict(provisioning_vm.results|
json_query('[].[item.key, item.value]')) }}"
gives
vm_dict:
80001:
host_ip_address: 10.10.0.1
host_name: ansible-clone1.dev.test.com
80002:
host_ip_address: 10.10.0.2
host_name: ansible-clone2.dev.test.com
80004:
host_ip_address: 10.10.10.4
host_name: ansible-clone4.dev.test.com
Optionally, the task below rejects changed items. Change the filter to selectattr if you want to select them
vm_dict: "{{ dict(provisioning_vm.results|
rejectattr('changed')|
json_query('[].[item.key, item.value]')) }}"

Error and notice in Phpmyadmin database. How to fix it?

It shows:
Warning in ./libraries/sql.lib.php#613
count(): Parameter must be an array or an object that implements Countable
Backtrace
./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#2062: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'wp_wordpress',
string 'wp_3_options',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_3_options`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'wp_wordpress',
string 'wp_3_options',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_3_options`',
NULL,
NULL,
)
And also:
Notice in ./libraries/DisplayResults.php#1229
Trying to access array offset on value of type bool
Backtrace
./libraries/DisplayResults.php#1349: PMA\libraries\DisplayResults->_getTableHeadersForColumns(
array,
array,
array,
array,
array,
boolean false,
string 'SELECT * FROM `wp_3_options` ',
)
./libraries/DisplayResults.php#4427: PMA\libraries\DisplayResults->_getTableHeaders(
array,
array,
string 'SELECT * FROM `wp_3_options` ',
array,
array,
array,
boolean false,
)
./libraries/sql.lib.php#1686: PMA\libraries\DisplayResults->getTable(
,
array,
array,
boolean false,
)
./libraries/sql.lib.php#1980: PMA_getHtmlForSqlQueryResultsTable(
,
string './themes/pmahomme/img/',
NULL,
array,
boolean true,
string '794',
integer 25,
NULL,
,
array,
)
./libraries/sql.lib.php#2199: PMA_getQueryResponseForResultsReturned(
,
array,
string 'wp_wordpress',
string 'wp_3_options',
NULL,
NULL,
,
string './themes/pmahomme/img/',
string '794',
integer 25,
NULL,
NULL,
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_3_options`',
NULL,
)
./libraries/sql.lib.php#2062: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'wp_wordpress',
string 'wp_3_options',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_3_options`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'wp_wordpress',
string 'wp_3_options',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_3_options`',
NULL,
NULL,
)
What this error and Notice mean and how to fix them? How do they affect my site?

Invalid column name in Entity Framework

I have an ASP.MET application. I performed the tutorial on code first migrations. When I executed the commands, the following code was generated for the user table:
CreateTable(
"dbo.AspNetUsers",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
ApplicationId = c.Guid(nullable: false),
Email = c.String(maxLength: 256),
EmailConfirmed = c.Boolean(nullable: false),
PasswordHash = c.String(),
SecurityStamp = c.String(),
PhoneNumber = c.String(),
PhoneNumberConfirmed = c.Boolean(nullable: false),
TwoFactorEnabled = c.Boolean(nullable: false),
LockoutEndDateUtc = c.DateTime(),
LockoutEnabled = c.Boolean(nullable: false),
AccessFailedCount = c.Int(nullable: true),
UserName = c.String(nullable: false, maxLength: 256),
Discriminator = c.String(),
LegacyPasswordHash = c.String(),
})
.PrimaryKey(t => t.Id)
.Index(t => t.UserName, unique: true, name: "UserNameIndex");
My problem is that I don't need some columns. So, I removed the code from those columns and updated my DB. But, when I try to authenticate a user, I get this error:
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
But these columns no longer exist because I deleted them.
Or, is it possible to put it back and assign them default values ​​for example:
EmailConfirmed = false
PhoneNumberConfirmed = false
to avoid making an insertion when creating a user. I use EF 6.2.0
Need help please.

Unable to perform NamedParameterJdbcTemplate UPDATE

I am trying to perform an UPDATE to a SnappyData row table via JDBC APIs and Spring's NamedParameterJdbcTemplate.
Error is:
Caused by: java.sql.SQLException: **(SQLState=XCL14 Severity=20000) The column position '1' is out of range. The number of columns for this ResultSet is '0'.**
at com.pivotal.gemfirexd.internal.shared.common.error.DefaultExceptionFactory40.getSQLException(DefaultExceptionFactory40.java:121)
at com.pivotal.gemfirexd.internal.shared.common.error.ExceptionUtil.newSQLException(ExceptionUtil.java:148)
at com.pivotal.gemfirexd.internal.client.am.SqlException.getSQLException(SqlException.java:419)
at com.pivotal.gemfirexd.internal.client.am.ColumnMetaData.getColumnType(ColumnMetaData.java:644)
at com.pivotal.gemfirexd.internal.client.am.PreparedStatement.setString(PreparedStatement.java:1203)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setString(HikariProxyPreparedStatement.java)
at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:429)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:235)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:150)
at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.setValues(PreparedStatementCreatorFactory.java:292)
at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:244)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:623)
... 70 more
Caused by: ERROR XCL14: The column position '1' is out of range. The number of columns for this ResultSet is '0'.
at com.pivotal.gemfirexd.internal.client.am.ColumnMetaData.checkForValidColumnIndex(ColumnMetaData.java:856)
at com.pivotal.gemfirexd.internal.client.am.ColumnMetaData.getColumnType(ColumnMetaData.java:638)
The NamedParameter SQL looks like this:
UPDATE generic_table_10 SET (VERSION = :version, FK_1 = :fk , COL_1 = :col1, COL_2 = :col2, COL_3 = :col3, COL_4 = :col4, COL_5 = :col5, COL_6 = :col6, COL_7 = :col7, COL_8 = :col8, COL_9 = :col9, COL_10 = :col10) WHERE (ID = :id and VERSION = :oldVersion)
NOTE: VERSION column type is an Integer. All the rest of the column
types are String.
The SQL looks like this, which seems alright to me:
UPDATE generic_table_10 SET (VERSION = ?, FK_1 = ? , COL_1 = ?, COL_2 = ?, COL_3 = ?, COL_4 = ?, COL_5 = ?, COL_6 = ?, COL_7 = ?, COL_8 = ?, COL_9 = ?, COL_10 = ?) WHERE (ID = ? and VERSION = ?)
I resolved this myself... The syntax is bad. I removed the parenthesis and it works now. Here is the SQL now:
UPDATE generic_table_10 SET VERSION = ?, FK_1 = ? , COL_1 = ?, COL_2 = ?, COL_3 = ?, COL_4 = ?, COL_5 = ?, COL_6 = ?, COL_7 = ?, COL_8 = ?, COL_9 = ?, COL_10 = ? WHERE ID = ? and VERSION = ?
I must say, despite my lack of SQL syntax skills, the error message was a bit misleading!

My Update Stored Procedure not working some times and not showing error SQL Server 2008 R2 queries attached?

I am trying to update my project that is already ex sis in table. Stored procedure is working fine in some projects but not updating in some project even it is not giving any error I can't find out error I am pasting my queries down there please check it out if there is any issue.
Table creation query:
CREATE TABLE [dbo].[Des_InventoryN]
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[Target_Project_ID] [int] NULL,
[Projects] [nvarchar](255) NULL,
[Bridge_Cost] [money] NULL,
[Hway_Cost] [money] NULL,
[Bridge_Comp] [nvarchar](50) NULL,
[Hway_Comp] [nvarchar](50) NULL,
[Proj_WCB] [nvarchar](50) NULL,
[Proj_Owner] [nvarchar](50) NULL,
[Ind_Exp] [bit] NOT NULL,
[Sub] [bit] NOT NULL,
[Sub_Prime_Factor] [nvarchar](50) NULL,
[M1] [bit] NOT NULL,
[M2] [bit] NOT NULL,
[M3] [bit] NOT NULL,
[M4] [bit] NOT NULL,
[M5] [bit] NOT NULL,
[M6] [bit] NOT NULL,
[M7] [bit] NOT NULL,
[M8] [bit] NOT NULL,
[M9] [bit] NOT NULL,
[M10] [bit] NOT NULL,
[E1] [bit] NOT NULL,
[E2] [bit] NOT NULL,
[E3] [bit] NOT NULL,
[E4] [bit] NOT NULL,
[E5] [bit] NOT NULL,
[E6] [bit] NOT NULL,
[E7] [bit] NOT NULL,
[E8] [bit] NOT NULL,
[E9] [bit] NOT NULL,
[E10] [bit] NOT NULL,
[E11] [bit] NOT NULL,
[E12] [bit] NOT NULL,
[E13] [bit] NOT NULL,
[E14] [bit] NOT NULL,
[E15] [bit] NOT NULL,
[E16] [bit] NOT NULL,
[E17] [bit] NOT NULL,
[E18] [bit] NOT NULL,
[E19] [bit] NOT NULL,
[E20] [bit] NOT NULL,
[E21] [bit] NOT NULL,
[E22] [bit] NOT NULL,
[E23] [bit] NOT NULL,
[E24] [bit] NOT NULL,
[E25] [bit] NOT NULL,
[E26] [bit] NOT NULL,
[O1] [bit] NOT NULL,
[O2] [bit] NOT NULL,
[O3] [bit] NOT NULL,
[O4] [bit] NOT NULL,
[O5] [bit] NOT NULL,
[O6] [bit] NOT NULL,
[O7] [bit] NOT NULL,
[O8] [bit] NOT NULL,
[O9] [bit] NOT NULL,
[O10] [bit] NOT NULL,
[O11] [bit] NOT NULL,
[O12] [bit] NOT NULL,
[O13] [bit] NOT NULL,
[O14] [bit] NOT NULL,
[upsize_ts] [timestamp] NULL,
[Creation] [datetime] NULL,
[UpdateTime] [datetime] NULL,
[Dnumber] [nvarchar](20) NULL,
[EIS_Chap_IV] [bit] NULL,
[EA_Chap_IV] [bit] NULL,
[Proj_Flag] [bit] NULL,
[Proj_Type] [nvarchar](50) NULL,
[Cus_ID] [int] NULL,
[SubPer] [nvarchar](50) NULL,
CONSTRAINT [PK_Des_InventoryN] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
Stored procedure for table:
CREATE PROCEDURE [dbo].[UpdateProject]
#Target_Project_ID int,
#Projects varchar(50),
#Bridge_Cost money,
#Hway_Cost money,
#Bridge_Comp nvarchar(50),
#Hway_Comp nvarchar(50),
#ProjectType nvarchar(50),
#Proj_Owner nvarchar(50),
#Proj_WCB nvarchar(50),
#Ind_Exp bit,
#Sub bit,
#M1 bit,
#M2 bit,
#M3 bit,
#M4 bit,
#M5 bit,
#M6 bit,
#M7 bit,
#M8 bit,
#M9 bit,
#M10 bit,
#E1 bit,
#E2 bit,
#E3 bit,
#E4 bit,
#E5 bit,
#E6 bit,
#E7 bit,
#E8 bit,
#E9 bit,
#E10 bit,
#E11 bit,
#E12 bit,
#E13 bit,
#E14 bit,
#E15 bit,
#E16 bit,
#E17 bit,
#E18 bit,
#E19 bit,
#E20 bit,
#E21 bit,
#E22 bit,
#E23 bit,
#E24 bit,
#E25 bit,
#E26 bit,
#O1 bit,
#O2 bit,
#O3 bit,
#O4 bit,
#O5 bit,
#O6 bit,
#O7 bit,
#O8 bit,
#O9 bit,
#O10 bit,
#O11 bit,
#O12 bit,
#O13 bit,
#O14 bit,
#Creation datetime,
#Dnumber nvarchar(30),
#SubPer nvarchar(30),
#Sub_Prime_Factor nvarchar(30)
AS
BEGIN
SET NOCOUNT ON;
UPDATE [InspectionDesign].[dbo].[Des_InventoryN]
SET
[Projects] = #Projects
,[Bridge_Cost] = #Bridge_Cost
,[Hway_Cost] = #Hway_Cost
,[Bridge_Comp] = #Bridge_Comp
,[Hway_Comp] = #Hway_Comp
,[Proj_WCB] = #Proj_WCB
,[Proj_Owner] = #Proj_Owner
,[Ind_Exp] = #Ind_Exp
,[Sub] = #Sub
,[M1] = #M1
,[M2] = #M2
,[M3] = #M3
,[M4] = #M4
,[M5] = #M5
,[M6] = #M6
,[M7] = #M7
,[M8] = #M8
,[M9] = #M9
,[M10] = #M10
,[E1] = #E1
,[E2] = #E2
,[E3] = #E3
,[E4] = #E4
,[E5] = #E5
,[E6] = #E6
,[E7] = #E7
,[E8] = #E8
,[E9] = #E9
,[E10] = #E10
,[E11] = #E11
,[E12] = #E12
,[E13] = #E13
,[E14] = #E14
,[E15] = #E15
,[E16] = #E16
,[E17] = #E17
,[E18] = #E18
,[E19] = #E19
,[E20] = #E20
,[E21] = #E21
,[E22] = #E22
,[E23] = #E23
,[E24] = #E24
,[E25] = #E25
,[E26] = #E26
,[O1] = #O1
,[O2] = #O2
,[O3] = #O3
,[O4] = #O4
,[O5] = #O5
,[O6] = #O6
,[O7] = #O7
,[O8] = #O8
,[O9] = #O9
,[O10] = #O10
,[O11] = #O11
,[O12] = #O12
,[O13] = #O13
,[O14] = #O14,
[UpdateTime] = #Creation,
[Dnumber] = #Dnumber,
[Proj_Type] = #ProjectType,
[SubPer] = #SubPer,
[Sub_Prime_Factor] = #Sub_Prime_Factor
WHERE
[ID] = #Target_Project_ID AND [Projects] = #Projects;
END
Query for passing parameters in stored procedure that is running fine but not updating project even not giving any error and displaying 1 row effected
I am just updating M1 value from 0 to 1 in this query while the rest of data is same so you have to insert data in table before updating same as mentioned in this query just M1 value 1 to 0
USE [InspectionDesign]
GO
DECLARE #return_value int
EXEC #return_value = [dbo].[UpdateProject]
#Target_Project_ID = 63,
#Projects = N'E. Third St 52nd St/LIRR & 19th St/NYCT Design & CSS',
#Bridge_Cost = 5101000.0,
#Hway_Cost = 953000.0,
#Bridge_Comp = N'2',
#Hway_Comp = N'1',
#ProjectType = N'1',
#Proj_Owner = N'4',
#Proj_WCB = N'3',
#Ind_Exp = false,
#Sub = false,
#M1 = 1,
#M2 = 0,
#M3 = 1,
#M4 = 1,
#M5 = 1,
#M6 = 1,
#M7 = 1,
#M8 = 1,
#M9 = 1,
#M10 = 1,
#E1 = 0,
#E2 = 0,
#E3 = 0,
#E4 = 0,
#E5 = 0,
#E6 = 0,
#E7 = 0,
#E8 = 0,
#E9 = 0,
#E10 = 0,
#E11 = 0,
#E12 = 0,
#E13 = 0,
#E14 = 0,
#E15 = 0,
#E16 = 0,
#E17 = 0,
#E18 = 0,
#E19 = 0,
#E20 = 0,
#E21 = 0,
#E22 = 0,
#E23 = 0,
#E24 = 0,
#E25 = 0,
#E26 = 0,
#O1 = 0,
#O2 = 0,
#O3 = 0,
#O4 = 0,
#O5 = 0,
#O6 = 0,
#O7 = 0,
#O8 = 0,
#O9 = 1,
#O10 = 0,
#O11 = 0,
#O12 = 1,
#O13 = 0,
#O14 = 0,
#Creation = N'4/1/2014 9:46:02 AM',
#Dnumber = N'D031095',
#SubPer = NULL,
#Sub_Prime_Factor = N'1'
SELECT 'Return Value' = #return_value
GO
Hopes for your suggestion thanks in advance.
In your Stored Procedure there is a where condition
where [ID] =#Target_Project_ID and [Projects]=#Projects;
you may update this as
where [Target_Project_ID] =#Target_Project_ID and [Projects]=#Projects;

Resources