Click here to Skip to main content
15,610,088 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I'm trying to create a webservice and I've looked at all different tutorials but I just can't seem to grasp it. Can someone help me? This is what I'm trying to do;

Create a Webservice that allows the user to enter SMS-style abbreviations, and returns the expanded meaning. Populated from a comma separated text file containing SMS-style abbreviations, and their expanded meaning

use a Dictionary Class to hold a list of SMS abbreviations and their meanings in English

Create an application that consumes the webservice.

I have some code but I'm unsure how to import/use it in a webservice. This is the code I currently have;

      private string dirCSV;
        private string fileNevCSV;
        public string FileNevCSV
            get { return fileNevCSV; }
            set { fileNevCSV = value; }
        public string dirCSV
            get { return dirCSV; }
            set { dirCSV = value; }

        public DataSet loadCVS(int noofrows)
            DataSet ds = new DataSet();
                string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + this.dirCSV.Trim() +
";Extensions=asc,csv,tab,txt;Persist Security Info=False";
                string sql_select;
                OdbcConnection conn;
                conn = new OdbcConnection(strConnString.Trim());
                if (noofrows == -1)
                    sql_select = "select * from [" + this.FileNevCSV.Trim() + "]";
                    sql_select = "select top " + noofrows + " * from [" + this.FileNevCSV.Trim() + "]";
                OdbcDataAdapter obj_oledb_da = new OdbcDataAdapter(sql_select, conn);
                obj_oledb_da.Fill(ds, "csv");
            catch (Exception e) //Error
            return ds;
this.dirCSV = "file path";
            this.fileNevCSV ="file name";
            DataSet ds = loadCVS(-1);
            DataTable table = ds.Tables[0];
            foreach (DataRow row in table.Rows)

Can anyone help me create this? Or point me in the direction of a good source?
Updated 24-Nov-13 9:23am

1 solution

I really cant't see where your problem is. This sounds like a simple web service with a single WebMethod accepting a string and returning a string. If you have trouble creating a WebService, I suggest you start with this nice tutorial: Your first C# Web Service[^]

PS: as I see, this is your homework, so struggle a little bit, and come here if you stuck at a more concrete step.
Share this answer
Member 10327654 24-Nov-13 16:22pm    
I've already done the tutorial and others and it's the webservice I have problem with. I know how to use it with an Windows Application but I just can't get the webservice to use the CSV with my code and I don't know where my error is as it compiles for me. So I'm confused
Zoltán Zörgő 24-Nov-13 16:48pm    
What is "you can't get"? Debug.
Member 10327654 24-Nov-13 16:54pm    
I don't understand why I get no errors but the webservice still isn't picking up the file I want it to pick up.
Zoltán Zörgő 25-Nov-13 1:44am    
I got that. My suggestion is again: debug.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900