Windows 7手机存储帮助 [英] Windows 7 Phone Storage Help

查看:86
本文介绍了Windows 7手机存储帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我正在忙着做Windows 7 Phone应用程序,并在存储方面苦苦挣扎.
我需要保存产品列表并进行检索.
我尝试了以下操作:隔离存储,SQLServer Azure,WCF.我的最后一招是Filestreams.

Hi there.

I''m busy doing a Windows 7 Phone App and struggling with storage.
I need to save a list of products and retrieve it.
I''ve tried the following: Isolate Storage, SQLServer Azure, WCF. My last resort is Filestreams.

DESPERATE HELP PLEASE!!!

推荐答案

外观,您必须将WCF层添加到项目中,然后在此WCF中创建自定义类和从数据库检索数据的函数就像任何Web应用程序一样(如果您有使用WCF的经验)! 示例:在service.cs中:
look man you have to add WCF layer to your project then in this WCF Create Custom Class and the function that retrieves data from data base as any web application (if you have experience in WCF)!!!!!
example: in service.cs :
[ServiceContract]
    public interface IService1
    {

        [OperationContract]//dont miss this 
        string GetItemInfo(string Category);
    }

    [DataContract]//dont miss this 
    public class Items
    {
        public string ID { get; set; }

        public string Category { get; set; }

        public string Info { get; set; }

        public int Quantity { get; set; }

        public string Mark { get; set; }

        public int Price { get; set; }
    }


并在service.svc.cs中,例如:


and in service.svc.cs ex:

string connection = ConfigurationManager.ConnectionStrings["Connection"].ToString();
        public string GetItemInfo(string Category)
        {
            Items items = new Items();

            SqlDataReader reader = null;
            SqlCommand cmd = new SqlCommand("select top(1) ID, Category, Info, Mark, Quantity, Price from item where category ='" + Category + "'");
            SqlConnection conn = new SqlConnection(connection);
            conn.Open();
            cmd.Connection = conn;
            reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                items = new Items();
                items.ID = (string)reader["ID"];
                items.Category = reader["Category"].ToString().Trim();
                items.Info = reader["info"].ToString().Trim();
                items.Mark = reader["Mark"].ToString().Trim();
                items.Quantity = Convert.ToInt16(reader["Quantity"]);
                items.Price = Convert.ToInt16(reader["Price"]);
            }
            conn.Close();
            return items.Info;
        }




而且您也可以使用sqlite,通过Google

问候




and also you can use sqlite, google it

Regards


通过下面的链接,这可能对您有帮助
此处 [
Go through the below link, this may helps you
Here[^]

Thanks
--RA


这篇关于Windows 7手机存储帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆