小编Net*_*101的帖子

Google Calendar API,只需知道他们的电子邮件地址即可向某人的日历添加活动

我已经下载了Google.Apis名称空间:

using Google.Apis.Auth.OAuth2;
using Google.Apis.Calendar.v3;
using Google.Apis.Calendar.v3.Data;
using Google.Apis.Services;
Run Code Online (Sandbox Code Playgroud)

我花了一整天的时间在网上查看.NET示例,了解如何通过了解他们的电子邮件地址将事件添加到某人日历中.

我尝试了下面的代码,但它会带来错误,很明显它不会起作用:

Public void Method(string email, string text)
{
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
                {
                    ClientId = "CLIENTID",
                    ClientSecret = "CLIENTSECRET",
                },
                new[] { CalendarService.Scope.Calendar },
                "user",
                CancellationToken.None).Result;

   // Create the service.
   var service = new CalendarService(new BaseClientService.Initializer()
   {
                HttpClientInitializer = credential,
                ApplicationName = "Calendar API Sample",
   });


    Event event1 = new Event()
    {
      Summary = "Something",
      Location = "Somewhere",
      Start = new EventDateTime() {
          DateTime = DateTime.Now,
          TimeZone = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net api calendar google-api

8
推荐指数
1
解决办法
2万
查看次数

SQL Insert语句语法

基本上我正在做的是,点击按钮后,程序将根据用户选择的内容从特定行中提取数据,并使用它将其放在不同的表中INSERT.以下是代码.

private void button3_Click(object sender, EventArgs e)
{
        const String connectionString = "Data Source = Vanessa-PC\\SQLEXPRESS; Initial Catalog = IUMDC; Connect Timeout = 15; Integrated Security = true";
        SqlConnection con = new SqlConnection(connectionString);

        //int SituationID1; 
        label24.Show();

        foreach (SitID x in Sittbl)
        {
            if (x.ID == Convert.ToInt16(comboBox1.SelectedItem))
            {
                try
                {
                    con.Open();
                    SqlCommand command = new SqlCommand("SELECT * FROM Situation WHERE SituationID=" + x.SitIDs, con);
                    SqlDataReader dr = command.ExecuteReader();

                    while (dr.Read())
                    {
                        sitid1 = Convert.ToInt32(dr[0]);
                        name1 = dr[4].ToString();
                        incident1 = …
Run Code Online (Sandbox Code Playgroud)

.net c# sql insert sql-server-express

5
推荐指数
1
解决办法
3万
查看次数

Ajax/Json错误:"在尝试引入列表时序列化类型对象时检测到循环引用"

我有一个通过JSON/Ajax调用的服务器端方法,它返回一个列表.该方法工作得非常好并返回列表,但是我显然在使用javascript做错了,因为它会带来错误:

""A circular reference was detected while serializing an object of type System.Data.Metadata.Edm.AssociationType""
Run Code Online (Sandbox Code Playgroud)

这是我的javascript:

function Generate() {      
        var nofm = $('#namemap').val();
        var numberV = $('#numberv').val();
        var param = '{"NameofMap":"' + nofm + '", "VillNum":"' + numberV + '"}';

        $.ajax({
            url: 'GenerateMap.aspx/AddVill',
            type: "POST",
            data: param,
            dataType: "json",
            contentType: "application/json",
            error: function (msg)
            { alert(msg.responseText); },
            success: function (result) {
                alert(Works);

            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery json

2
推荐指数
1
解决办法
1646
查看次数

标签 统计

c# ×2

.net ×1

ajax ×1

api ×1

asp.net ×1

calendar ×1

google-api ×1

insert ×1

javascript ×1

jquery ×1

json ×1

sql ×1

sql-server-express ×1