using System.Data.SqlClient;
private void ValidationFile()
{
string FilePath = "";
using (SqlConnection myConnection = new SqlConnection("Data Source=servername;Initial Catalog=db_name;User ID=user;Password=pass;"))
{
using (SqlCommand myCommand = new SqlCommand("select scanned_document_id, master_id, file_path from scanned_documents", myConnection))
{
myCommand.CommandType = CommandType.Text;
myConnection.Open();
using (SqlDataReader myReader = myCommand.ExecuteReader())
{
if (myReader.HasRows)
{
while (myReader.Read())
{
FilePath =
myReader.GetString(myReader.GetOrdinal("file_path"));
}}}}}}
Related