| |

VerySource

 Forgot password?
 Register
Search
View: 855|Reply: 5

A simple choice sentence, I am new, the language is not very familiar, please look at it with a master, thank you

[Copy link]

2

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-3 12:10:01
| Show all posts |Read mode
Sql: = 'update ZW.BZ set workdate =' '' + DateToStr (Self.DateTimePicker1.Date) + '' ', BANZU =' '' + Trim (ComboBox1.Text) + '' ', car =' '' + Trim (Edit1.Text) + '' 'where banzu =' + (Query1.FieldByName ('banzu'). AsString);

This sentence doesn't pass. I don't know if it's wrong. I don't have a book at hand. Thank you for your help.
Reply

Use magic Report

0

Threads

12

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-3 12:12:01
| Show all posts
Sql: = 'update ZW.BZ set workdate =' '' + DateToStr (Self.DateTimePicker1.Date) + '' '+', BANZU = '' '+ Trim (ComboBox1.Text) +' '' + ', car = '' '+ Trim (Edit1.Text) +' '' where banzu = '+ (Query1.FieldByName (' banzu '). AsString);
-------------------------------------------------- --------------------

It's a bit messy to write this way;
sql: = format ('update zw.bz set workdate = ``% s' ', Banzu = ``% s' ', car = ``% s' 'where banzu = ``% s' '', [DateToStr (Self.DateTimePicker1.Date), Trim (ComboBox1.Text), Trim (Edit1.Text), Query1.FieldByName ('banzu'). AsString]);
Reply

Use magic Report

0

Threads

12

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-3 12:15:01
| Show all posts
If you have to write it like this: Or it should be written like this:
Sql: = 'update ZW.BZ set workdate =' '' + DateToStr (Self.DateTimePicker1.Date) + '' ', BANZU =' '' + Trim (ComboBox1.Text) + '' ', car =' '' + Trim (Edit1.Text) + '' 'where banzu =' '' + (Query1.FieldByName ('banzu'). AsString) + '' ';
Reply

Use magic Report

0

Threads

53

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-1-3 13:48:02
| Show all posts
The reason for not passing, you can check this statement when executing the SQL statement. To see if it is correct, I think the problem mainly occurs in the type matching, it may be the wrong type
Recommended parameters
E.g:
Sql: = 'update ZW.BZ set workdate =: workdate, BANZU =: BANZU, car =: Car where banzu =: banzu2'
// cmd represents the data set execution component
// If the field workdate is a date field
cmd.Parameters.ParamByName ('workdate') .Value: = DateTimePicker1.Date;
Other similar
Reply

Use magic Report

2

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-3 14:30:01
| Show all posts
It can pass now, but the data item that always jumps out of banzu appears SQL6022N. It is invalid in the context of using it. What could be the problem? ?
Reply

Use magic Report

2

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-3 14:33:01
| Show all posts
Wrong is 0206N
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list