Hi there, it is my first time creating a webservice so pardon me for my poor knowledge
I need to retrieve filepaths which is stored in my database by using web service. I tried writing the codes as shown below, but it keeps prompt me saying : not all code paths return a value.
[WebMethod]
public string getImages(int minutesID)
{
SAConnection myConnection = new SAConnection(DB_STR);
string filepath;
//open the connection
myConnection.Open();
//Create a command object.
SACommand myCommand = myConnection.CreateCommand();
SAParameter prms = new SAParameter();
prms.SADbType = SADbType.Integer;
myCommand.Parameters.Add(prms);
myCommand.Parameters[0].Value = minutesID;
//Specify a query.
myCommand.CommandText = "SELECT filePath from attachments WHERE minutesID = ?";
//Create a DataReader for the command
SADataReader reader = myCommand.ExecuteReader();
while (reader.Read())
{
filepath = reader.GetString(0);
filepath = Server.MapPath(filepath);
return filepath;
//imagePath.Add(new String(filepath));
}
I have another query in mind.
1) Should i return string or an array of string which contains the file path?