Why do i keep getting a parameter error in my sql update?
I have been trying to use SQL with PYQT4 to update an access database with information a user has inputted into my program. I don't want to update all of the records just a specific record and a specific amount of columns (5 out of the 10 columns). however, I keep getting an error that reads:
"pyodbc.Error: ('07002', '[07002] [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 6. (-3010) (SQLExecDirectW)')"
I can't seem to resolve it.
Here is my code:
SelectDatabase.execute('UPDATE Order_Table SET DateDue=(dateDueString), TimeDue=(timeDueString), PaymentType=(paymentExp), Paid=(paidExp), Customer_ID=(customerExp) WHERE OrderLine_ID=(orderlineExp)')
The values inside the brackets are variables that I have created and I am trying to call upon them, I have proof checked them multiple times, including spell checking them and I can't find a problem in that regard.
If anyone has any ideas or needs more information please let me know.
sql ms-access pyodbc
add a comment |
I have been trying to use SQL with PYQT4 to update an access database with information a user has inputted into my program. I don't want to update all of the records just a specific record and a specific amount of columns (5 out of the 10 columns). however, I keep getting an error that reads:
"pyodbc.Error: ('07002', '[07002] [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 6. (-3010) (SQLExecDirectW)')"
I can't seem to resolve it.
Here is my code:
SelectDatabase.execute('UPDATE Order_Table SET DateDue=(dateDueString), TimeDue=(timeDueString), PaymentType=(paymentExp), Paid=(paidExp), Customer_ID=(customerExp) WHERE OrderLine_ID=(orderlineExp)')
The values inside the brackets are variables that I have created and I am trying to call upon them, I have proof checked them multiple times, including spell checking them and I can't find a problem in that regard.
If anyone has any ideas or needs more information please let me know.
sql ms-access pyodbc
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43
add a comment |
I have been trying to use SQL with PYQT4 to update an access database with information a user has inputted into my program. I don't want to update all of the records just a specific record and a specific amount of columns (5 out of the 10 columns). however, I keep getting an error that reads:
"pyodbc.Error: ('07002', '[07002] [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 6. (-3010) (SQLExecDirectW)')"
I can't seem to resolve it.
Here is my code:
SelectDatabase.execute('UPDATE Order_Table SET DateDue=(dateDueString), TimeDue=(timeDueString), PaymentType=(paymentExp), Paid=(paidExp), Customer_ID=(customerExp) WHERE OrderLine_ID=(orderlineExp)')
The values inside the brackets are variables that I have created and I am trying to call upon them, I have proof checked them multiple times, including spell checking them and I can't find a problem in that regard.
If anyone has any ideas or needs more information please let me know.
sql ms-access pyodbc
I have been trying to use SQL with PYQT4 to update an access database with information a user has inputted into my program. I don't want to update all of the records just a specific record and a specific amount of columns (5 out of the 10 columns). however, I keep getting an error that reads:
"pyodbc.Error: ('07002', '[07002] [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 6. (-3010) (SQLExecDirectW)')"
I can't seem to resolve it.
Here is my code:
SelectDatabase.execute('UPDATE Order_Table SET DateDue=(dateDueString), TimeDue=(timeDueString), PaymentType=(paymentExp), Paid=(paidExp), Customer_ID=(customerExp) WHERE OrderLine_ID=(orderlineExp)')
The values inside the brackets are variables that I have created and I am trying to call upon them, I have proof checked them multiple times, including spell checking them and I can't find a problem in that regard.
If anyone has any ideas or needs more information please let me know.
sql ms-access pyodbc
sql ms-access pyodbc
edited Nov 15 '18 at 15:51
eyllanesc
80.2k103258
80.2k103258
asked Nov 14 '18 at 22:16
Jacob B.Jacob B.
113
113
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43
add a comment |
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43
add a comment |
2 Answers
2
active
oldest
votes
I have managed to figure out the problem. I was trying to use a variable within my SQL which once I had formatted differently worked straight away this is what I changed it to.
SelectDatabase.execute('UPDATE Order_Table SET DateDue=?, TimeDue=?, PaymentType=?, Paid=?, Customer_ID=? WHERE OrderLine_ID=?', dateDueString,timeDueString,paymentExp,paidExp,customerExp,orderlineExp)
This way by changing the values to unknowns inside the SQL procedure and referencing them in order after the edit allowed for the string values of the variables to be found and the correct columns to be edited.
Thank-you for trying to help.
add a comment |
Well i guess you need create your stored procedure in SQL first with all parameters and then simply call it.
Exec dbo.mYParameter 'timeDueString','paymentExp','paidExp','customerExp','orderlineExp'
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309564%2fwhy-do-i-keep-getting-a-parameter-error-in-my-sql-update%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have managed to figure out the problem. I was trying to use a variable within my SQL which once I had formatted differently worked straight away this is what I changed it to.
SelectDatabase.execute('UPDATE Order_Table SET DateDue=?, TimeDue=?, PaymentType=?, Paid=?, Customer_ID=? WHERE OrderLine_ID=?', dateDueString,timeDueString,paymentExp,paidExp,customerExp,orderlineExp)
This way by changing the values to unknowns inside the SQL procedure and referencing them in order after the edit allowed for the string values of the variables to be found and the correct columns to be edited.
Thank-you for trying to help.
add a comment |
I have managed to figure out the problem. I was trying to use a variable within my SQL which once I had formatted differently worked straight away this is what I changed it to.
SelectDatabase.execute('UPDATE Order_Table SET DateDue=?, TimeDue=?, PaymentType=?, Paid=?, Customer_ID=? WHERE OrderLine_ID=?', dateDueString,timeDueString,paymentExp,paidExp,customerExp,orderlineExp)
This way by changing the values to unknowns inside the SQL procedure and referencing them in order after the edit allowed for the string values of the variables to be found and the correct columns to be edited.
Thank-you for trying to help.
add a comment |
I have managed to figure out the problem. I was trying to use a variable within my SQL which once I had formatted differently worked straight away this is what I changed it to.
SelectDatabase.execute('UPDATE Order_Table SET DateDue=?, TimeDue=?, PaymentType=?, Paid=?, Customer_ID=? WHERE OrderLine_ID=?', dateDueString,timeDueString,paymentExp,paidExp,customerExp,orderlineExp)
This way by changing the values to unknowns inside the SQL procedure and referencing them in order after the edit allowed for the string values of the variables to be found and the correct columns to be edited.
Thank-you for trying to help.
I have managed to figure out the problem. I was trying to use a variable within my SQL which once I had formatted differently worked straight away this is what I changed it to.
SelectDatabase.execute('UPDATE Order_Table SET DateDue=?, TimeDue=?, PaymentType=?, Paid=?, Customer_ID=? WHERE OrderLine_ID=?', dateDueString,timeDueString,paymentExp,paidExp,customerExp,orderlineExp)
This way by changing the values to unknowns inside the SQL procedure and referencing them in order after the edit allowed for the string values of the variables to be found and the correct columns to be edited.
Thank-you for trying to help.
answered Nov 15 '18 at 7:53
Jacob B.Jacob B.
113
113
add a comment |
add a comment |
Well i guess you need create your stored procedure in SQL first with all parameters and then simply call it.
Exec dbo.mYParameter 'timeDueString','paymentExp','paidExp','customerExp','orderlineExp'
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
add a comment |
Well i guess you need create your stored procedure in SQL first with all parameters and then simply call it.
Exec dbo.mYParameter 'timeDueString','paymentExp','paidExp','customerExp','orderlineExp'
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
add a comment |
Well i guess you need create your stored procedure in SQL first with all parameters and then simply call it.
Exec dbo.mYParameter 'timeDueString','paymentExp','paidExp','customerExp','orderlineExp'
Well i guess you need create your stored procedure in SQL first with all parameters and then simply call it.
Exec dbo.mYParameter 'timeDueString','paymentExp','paidExp','customerExp','orderlineExp'
answered Nov 14 '18 at 23:39
RaniduRanidu
192
192
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
add a comment |
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
How would I write that in code? And would that fetch the variable value of 'timeDueString', 'paymentType', ect. Because they're not strings but variables that have a string value, that is completely dependent on what a user would enter into my program.
– Jacob B.
Nov 15 '18 at 7:39
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309564%2fwhy-do-i-keep-getting-a-parameter-error-in-my-sql-update%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
suggest you include the code that defines the parameters. are there mandatory (not null) columns in the table? could any of those be missing from your update statement?
– Used_By_Already
Nov 14 '18 at 22:23
I have no mandatory columns in my table, so I can have null values at this moment in time
– Jacob B.
Nov 14 '18 at 23:24
Your statement requires values for the names placeholders. Have you provided values?
– Bohemian♦
Nov 14 '18 at 23:48
All of the variables I have called upon to update a column with are linked to a string value that the user will input into my code. For example, the 'dateDueString' is a string that has been converted from the QtDate format and 'paidExp' is Boolean value.
– Jacob B.
Nov 15 '18 at 7:43