| |

VerySource

 Forgot password?
 Register
Search
View: 832|Reply: 7

Just learned, just done, ask questions

[Copy link]

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-18 11:00:01
| Show all posts |Read mode
string txtFileName = @ "D:\" + DropDownList1.SelectedValue;

I mean, I used the drop-down menu to select a text file. When I want to read the address of this file, it is written as above, and an exception is thrown when executing the following code

Please give pointers
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-23 17:18:01
| Show all posts
What the hell is that?
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-23 18:09:01
| Show all posts
Is it okay to write like this?
It is executed in the catch, I did not specifically define the catch
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-23 18:18:01
| Show all posts
The file may not exist. Post the exception.
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 Invalid IP Address

 Author| Post time: 2020-1-23 20:45:01
| Show all posts
The file exists, I read the file of the D drive into the drop-down menu, and then of course the specific selected file exists

string txtFileName = @ "D:\" + DropDownList1.SelectedValue;
Connect to the database;
try {
Read the line;
Write;)
catch {an output statement;
}
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-23 22:18:01
| Show all posts
Are you sure that DropDownList1.SelectedValue stores the file name instead of just setting DropDownList1.SelectedItem.Text?
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-24 13:00:02
| Show all posts
It seems that the problem is not here. The following lines of data are read out.
May be the problem is the database inserted, huh, huh
Reply

Use magic Report

2

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-24 13:09:02
| Show all posts
Hey alright
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