Microsoft SQL Server 2008 Connector

1
0
-1

Hey folks, I am trying to insert data in to an SQL Server Database.

The connection is fine but the insert fails. I am using sql below:

insert into user_group (description,btype,password,intra_user,fname,lname,login_name,email,primary_org_id,primary_g_id,image_id,knowledge_id,name,ntlogon,sql_user,private_flag,title,mobile,skills) values ('$hrJobTitle',u,'$hashedData',1,'$hrFirstname','$hrSurname','$hrLoginName','$hrEmailWork',159,30,-1,-1,'$fullName','$hrLoginName',True,False,'$hrTitle','','')

Now, the variables are string. If I use the above as it is, it inserts in to the table but the fields have data as '$var' (the variable name) rahter than the data stored for the variable.

I have tried to use '"+$hrVariable+"' and have tried to use '"$hrVariable"' but neither work.

How should this be formatted?

Thanks folks, Jim

2 answers

1
+1
-1
This one is the BEST answer!

Hey folks, Nevermind. I have found my mistake.

I need to use ${var} I forgor to add the {}

Thanks anyway, Jim

1
0
-1

Hey folks, So, to confirm:

The sql was originally:

insert into user_group (description,btype,password,intra_user,fname,lname,login_name,email,primary_org_id,primary_g_id,image_id,knowledge_id,name,ntlogon,sql_user,private_flag,title,mobile,skills) values ('$hrJobTitle',u,'$hashedData',1,'$hrFirstname','$hrSurname','$hrLoginName','$hrEmailWork',159,30,-1,-1,'$fullName','$hrLoginName',True,False,'$hrTitle','','') - See more at: http://community.bonitasoft.com/answers/microsoft-sql-server-2008-connec...

It should be:

insert into user_group (description,btype,password,intra_user,fname,lname,login_name,email,primary_org_id,primary_g_id,image_id,knowledge_id,name,ntlogon,sql_user,private_flag,title,mobile,skills) values ('${hrJobTitle}','u','${hashedData}',1,'${hrFirstname}','${hrSurname}','${hrLoginName}','${hrEmailWork}',159,30,-1,-1,'${fullName}','${hrLoginName}','True','False','${hrTitle}','','')

So, dont forget the {} like me! ha.

Ta, Jim

Notifications