Home
Manage Your Code
Snippet: Ritorna Comune (C#)
Title: Ritorna Comune Language: C#
Description: Ritorna Comune Views: 132
Author: Roby Solei Date Added: 10/29/2008
Copy Code  
1private string RitornaComune(string CodCat, string NomeDB)
2        {
3            string conn = StringaConnessione.GetStringaConnessione(NomeDB);
4            SqlConnection connection = new SqlConnection(conn);
5            SqlDataAdapter adapter = new SqlDataAdapter();
6            String StrSql = "SELECT COMUNE FROM COMUNI WHERE " +
7                            "CODCAT='" + CodCat + "'";
8            adapter.SelectCommand = new SqlCommand(StrSql, connection);
9            SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
10            connection.Open();
11            DataSet dataSet = new DataSet();
12            adapter.Fill(dataSet, "COMUNI");
13            string DesComune = dataSet.Tables["COMUNI"].Rows[0]["COMUNE"].ToString();
14            connection.Close();
15            return DesComune;
16
17        }