Home > Net >  $statement is modified into a string. The Format statement, the code can change
$statement is modified into a string. The Format statement, the code can change

Time:04-05

String sqlString=$" insert into Students (StudentName, Gender, Birthday, AttendanceNO, Stulmage, Age, Phone, StudentAddress) VALUES (' {Students. StudentName} ', '{Students. Gender}', '{Students. Birthday}', '{Students. AttendanceNO}', '{Students. Stulmage}, {Students. Age},' {Students. Phone} ', '{Students. StudentAddress}') ";

CodePudding user response:

String sqlString=$" insert into Students (StudentName, Gender, Birthday, AttendanceNO, Stulmage, Age, Phone, StudentAddress) VALUES (' {0} ', '{1}' and '{2}', '{Students. AttendanceNO}', '{3}, {4}, {5},' {6},
"Students Birthday, students AttendanceNO, students. Stulmage, students. The Age, students. Phone, students. StudentAddress) ";

CodePudding user response:

A little leak
$to the string. Format (
  •  Tags:  
  • C#
  • Related