Cause:
There are seven SQL statements with more than 50 rows. But it cannot be stored in the database as a stored procedure. In this way, sqlstr. append ("and"); must be appended to each row in the background logic written to C.
After:
1. In the console, copy the SQL statement to vs, beautify it, and record each line, that is, ensure that there is no space in the first letter.
2. Copy the beautifying statement to the C: \ test.txt file. Create a newfile.txt file under the same directory to store new files.
3. Write the following to the console:Code:
4. Run the command. You can see that the changed SQL statement is also displayed on the console. Then you can copy newfile.txt.
UsingSystem;
UsingSystem. Collections. Generic;
UsingSystem. LINQ;
UsingSystem. text;
UsingSystem. IO;
UsingSystem. collections;
NamespaceFileoperation {
ClassProgram {
Static VoidMain (String[] ARGs ){
// Filestream FS = new filestream (@ "C: \ carerror.txt", filemode. Open, fileaccess. readwrite );
Streamreader objreader =NewStreamreader (@ "C: \ test.txt", Encoding. Default );
Streamwriter Sw =NewStreamwriter (@ "C: \ newfile.txt");
StringSline ="";
Arraylist Al =NewArraylist ();
While(Sline! =Null){
Sline = objreader. Readline ();
If(Sline! =Null){
Al. Add ("Strsql. append (\""+ Sline +"\");");
}
}
Objreader. Close ();
Foreach(StringSInAl ){
Sw. writeline (s );
Console. writeline (s );
}
Sw. Close ();
Console. Readline ();
}
}
}
Result:
1. The append is successfully completed. Note: In streamreader, please note that if no encoding is added, garbled characters will appear in the output.
2. accumulation.