I’m new to Delphi7.
When I try to use the editor’s «Add all fields» feature on a TClientDataSet object a messagebox (the classic error message box) appear with the message «No value for parameter ‘(the name of the parameter)'».
I can’t add fields using the «all fields» feature anymore.
How can I find the source of the «No value for parameter» error?
bluish
26.1k27 gold badges120 silver badges179 bronze badges
asked Nov 21, 2011 at 17:55
The problem is (most likely) that the ClientDataSet is not filled with any data.
Lacking data, no fields can be listed.
Do the following:
- put a connection on the form. [connection1]
- Connect it to a database fill in login, password, database, and whatnot.
- Make the connection active. (only possible if all the connection parameters are filled in correctly).
- put a table on the form. [table1]
- Set it’s
connection
property to connection1. - Set the
tablename
property to a valid table; setactive
to true. - Put a
datasetprovider
on the form. [datasetprovider1] - Set the
dataset
to table1. - Put a clientdataset on your form [cds1].
- Set the
providername
of cds1 to datasetprovider1. - Set
cds1.Active
to true
Now you can select fields, because now the cds holds actual data.
answered Nov 21, 2011 at 18:08
JohanJohan
74.3k23 gold badges191 silver badges318 bronze badges
I managed by myself. The TClientDataSet
object had a parameter with DataType
and ParamType
properties both set to Unknown
. Setting the parameter with correct properties solved the problem, I was able to «add all fields» again. Thanks for the answers.
answered Nov 22, 2011 at 7:49
FrancescoFrancesco
1,7225 gold badges44 silver badges76 bronze badges
I don’t think any data is necessary to do what you want — and the first answer provided does not seem to include data, even though that is the original statement. You should be able to add all fields so long as you have a connection to a table, query, stored procedure or something similar.
Your question says there is no value for a parameter, and shows which parameter — although you don’t say. But it is probably the parameter for a query or such. That query is failing because you are not providing a parameter, therefore you don’t get any results. Of course this includes no fields.
Check the parameter in the error message.
answered Nov 22, 2011 at 3:02
Back to top
Edit this page
Toggle table of contents sidebar
Message emitted:
No value for argument %s in %s call
Description:
Used when a function call passes too few arguments.
Problematic code:
def add(x, y): return x + y add(1) # [no-value-for-parameter]
Correct code:
def add(x, y): return x + y add(1, 2)
Created by the typecheck checker.
dose this issue fixed?
I had the same problem for sql with password function :
INSERT INTO xxx (create_time, modify_time, is_deleted,
supplier_name, route_id, status, account, password,
contacts, phone, email, app_id, app_secret, channel_types, switch_status,
def_channel_type, api_type, supplier_type, sync_type_id)
VALUES (NOW(), NOW(), #{isDeleted,jdbcType=TINYINT},
#{supplierName,jdbcType=VARCHAR}, #{routeId,jdbcType=BIGINT}, #{status},
#{account}, password(#{password}), #{contacts}, #{phone},
#{email}, #{appId}, #{appSecret}, #{channelTypes}, #{switchStatus},
#{defChannelType}, #{apiType}, #{supplierType}, #{syncTypeId})
I have a lot of packages that I run Stored Procs with. I don’t write the procs just build the packages and export the data.
In my Source editor I always use this:
SET FMTONLY OFF;
SET NOCOUNT ON;
exec [Extract].[usp_HB_VEI_Outbound_Collections] ?,?,?
and in my Set Query Parameters I use the same name for the parameters as they are in the proc
@StartDate, @EndDate and then point them to variables. E.g. user::prmStartDate, user::prmEndDate
Now today I am getting the error «No Value given for one or more required parameters» on a new package. But when I went back to old packages to make sure I was building the SQL Command text and parameters correct I found all my old packages trigger
this error now.
The only thing I can think of is that I have installed SQL Server 2012 data tools on the box and that is causing it or the SQL Server has been updated with a patch or hotfix.
Has anyone else seen this? Is there a work around?
Thanks,
Phil
An error occurred when registering data.
java.sql.SQLException: No value specified for parameter 9
at com.mysql.jdbc.SQLError.createSQLException (SQLError.java:1073)
at com.mysql.jdbc.SQLError.createSQLException (SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException (SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException (SQLError.java:927)
at com.mysql.jdbc.PreparedStatement.checkAllParametersSet (PreparedStatement.java:2566)
at com.mysql.jdbc.PreparedStatement.fillSendPacket (PreparedStatement.java:2542)
at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2389)
at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2333)
at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2318)
at exercise_jdbc_kihon_enshu_combineRegist.SendSqlOrder.sendSqlOrder (SendSqlOrder.java:82)
at exercise_jdbc_kihon_enshu_combineRegist.ReadFile.csv_read (ReadFile.java:44)
at exercise_jdbc_kihon_enshu_combineRegist.FileChooser.fileChooser (FileChooser.java:42)
at exercise_jdbc_kihon_enshu_combineRegist.UI $2.actionPerformed (UI.java:81)
at javax.swing.AbstractButton.fireActionPerformed (AbstractButton.java:1995)
at javax.swing.AbstractButton $Handler.actionPerformed (AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed (DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased (BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent (Component.java:6297)
at javax.swing.JComponent.processMouseEvent (JComponent.java:3275)
at java.awt.Component.processEvent (Component.java:6062)
at java.awt.Container.processEvent (Container.java:2039)
at java.awt.Component.dispatchEventImpl (Component.java:4660)
at java.awt.Container.dispatchEventImpl (Container.java:2097)
at java.awt.Component.dispatchEvent (Component.java:4488)
at java.awt.LightweightDispatcher.retargetMouseEvent (Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent (Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent (Container.java:4166)
at java.awt.Container.dispatchEventImpl (Container.java:2083)
at java.awt.Window.dispatchEventImpl (Window.java:2489)
at java.awt.Component.dispatchEvent (Component.java:4488)
at java.awt.EventQueue.dispatchEventImpl (EventQueue.java:674)
at java.awt.EventQueue.access $400 (EventQueue.java:81)
at java.awt.EventQueue $2.run (EventQueue.java:633)
at java.awt.EventQueue $2.run (EventQueue.java:631)
at java.security.AccessController.doPrivileged (Native Method)
at java.security.AccessControlContext $1.doIntersectionPrivilege (AccessControlContext.java:87)
at java.security.AccessControlContext $1.doIntersectionPrivilege (AccessControlContext.java:98)
at java.awt.EventQueue $3.run (EventQueue.java:647)
at java.awt.EventQueue $3.run (EventQueue.java:645)
at java.security.AccessController.doPrivileged (Native Method)
at java.security.AccessControlContext $1.doIntersectionPrivilege (AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent (EventQueue.java:644)
at java.awt.EventDispatchThread.pumpOneEventForFilters (EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter (EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run (EventDispatchThread.java:122)
source code:
package exercise_jdbc_kihon_enshu_combineRegist;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Iterator;
import java.util.List;
import javax.swing.JOptionPane;
public class SendSqlOrder {
public SendSqlOrder () {
// TODO auto-generated constructor stub
}
public static void main (String [] args) {
}
public void sendSqlOrder (List<FileDataAccount>ListfileData) {
int sqlExeRstCnt = 0;
int total_sqlExeRstCnt = 0;
Connection con = null;
PreparedStatement pstmt = null;
try {
// ①Load JDBC driver
// Load the JDBC driver. Load JDBC driver with static method of Class class (JDBC
// DRIVER registration)
Class.forName ("com.mysql.jdbc.Driver");
// 2. Get connection to MySQL database and set arguments// Connect to the database from the driver manager
String url = "jdbc: mysql: // localhost/witc_si_kenshu? User = root&password = root";
con = DriverManager.getConnection (url);
// Transaction settings>Auto-commit release
con.setAutoCommit (false);
StringBuilder sbrSql = new StringBuilder ();
// Four. SQL statement construction
for (Iterator<FileDataAccount>vrb_ite = ListfileData.iterator ();vrb_ite.hasNext ();) {
FileDataAccount vrb_FileDataAccount = vrb_ite.next ();
sbrSql.append ("INSERT IGNORE INTO");
sbrSql.append ("AUTHENTICATION_ACCOUNT (");
sbrSql.append ("AUTH_USER_ID, AUTH_USER_NAME, AUTH_PASSWORD, AUTH_USER_LVL, AUTH_DEPT_CD, AUTH_DELETE_FLG, CREATE_DATE, CREATE_USER");
sbrSql.append (")");
sbrSql.append ("VALUES (");
sbrSql.append ("?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (",?");
sbrSql.append (")");
// 4-1 SQL statement for connection
pstmt = con.prepareStatement (sbrSql.toString ());
// 4-2 Value setting in SQL statement
pstmt.setString (1, vrb_FileDataAccount.getAuth_user_id ());
pstmt.setString (2, vrb_FileDataAccount.getAuth_user_name ());
pstmt.setString (3, vrb_FileDataAccount.getAuth_password ());
pstmt.setString (4, vrb_FileDataAccount.getAuth_user_lvl ());
pstmt.setInt (5, vrb_FileDataAccount.getAuth_dept_cd ());
pstmt.setInt (6, vrb_FileDataAccount.getAuth_delete_flg ());
pstmt.setTimestamp (7, new Timestamp (System.currentTimeMillis ()));
pstmt.setString (8, "root");
// 5. Execute SQL (query)
// For addition/update/deletion: Use SQL statement/executeUpdate method
// SQL execution result is returned as number of cases
sqlExeRstCnt = pstmt.executeUpdate ();
total_sqlExeRstCnt + = sqlExeRstCnt;
}
if (total_sqlExeRstCnt>0) {
con.commit ();
JOptionPane.showMessageDialog (null, total_sqlExeRstCnt + "The data has been updated.", "Update result",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog (null, "Update failed", "Update result",
JOptionPane.INFORMATION_MESSAGE);
}
} catch (Exception ec) {
try {
// 8. Data destruction
con.rollback ();
ec.printStackTrace ();
System.out.println ("a");
} catch (SQLException e) {
e.printStackTrace ();
} finally {
try {
// If the statement instance is not closed, close it
if (pstmt! = null) {
// close the statement instance
pstmt.close ();
} // end if
// If the connection instance is not closed, close it
if (con! = null) {
// close the connection
con.close ();
} // end if
} catch (SQLException e) {
e.printStackTrace ();
}
}
}
}
}
information:(language/FW/tool version etc.)
java1.6 eclipse