Hey there! any question in your mind? Ask It Now!.

Popular Categories

How to get data from android through web services and update database?

0 votes
asked in Programming by monika (2,040 points)

i am using this code to get database and convert it into JSON and display in android through web services.

public string Method()
        DataTable dt = new DataTable();
        using (SqlConnection con = new SqlConnection(@"Connection_string"))
            using (SqlCommand cmd = new SqlCommand("_query_", con))
  SqlDataAdapter da = new SqlDataAdapter(cmd);
  System.Web.Script.Serialization.JavaScriptSerializer serializer 
            = new System.Web.Script.Serialization.JavaScriptSerializer();
   List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
                Dictionary<string, object> row;
                foreach (DataRow dr in dt.Rows)
                    row = new Dictionary<string, object>();
                    foreach (DataColumn col in dt.Columns)
                        row.Add(col.ColumnName, dr[col]);
                return serializer.Serialize(rows);

In the same way if an android app gives a data then how would I be able to get that data and insert it into database?

Please log in or register to answer this question.

Related Questions

+7 votes
7 answers 1,896 views
+8 votes
2 answers 175 views
+1 vote
1 answer 324 views
+8 votes
1 answer 184 views
+2 votes
1 answer 1,475 views
+1 vote
2 answers 276 views
+1 vote
1 answer 1,245 views
0 votes
0 answers 276 views

Not a Member yet?

Ask to Folks Login

My Account
345 Folks are online
0 members and 345 guest online
Your feedback is highly appreciated