Load Data from Microsoft SQL Server Management Studio Fail

Hi Stanislav,

I really appreciate all the help you have been giving me in trying to get this to work. I fell back on using the .net adapter as I thought that wouldn’t have any dependencies or need any installation.

Following the example online on the .net adapter I get the following error Error 7 ‘dhtmlxConnectors.dhtmlxSchedulerConnector’ does not contain a constructor that takes 5 arguments C:\Users\syeap1\documents\visual studio 2013\Projects\calendar\calendar\connector\myconnector.ashx.cs 19 20 calendar

when I run this in VS2013.

This is my code for the connector

[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using dhtmlxConnectors;
using System.Configuration;

namespace calendar.connector
{
///


/// Summary description for myconnector
///

public class myconnector : dhtmlxRequestHandler
{

    public override IdhtmlxConnector CreateConnector(HttpContext context)
    {
        return new dhtmlxSchedulerConnector(
           "events", //table to select from
           "start_date,end_date,text", //fields to select 
           "id", //primary key column name
           dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type
           ConfigurationManager.ConnectionStrings["downtime"].ConnectionString //connection string
           //, "start_date"
           //, "end_date"
           //, "text"
        );
    }
}

}[/code]

I modified this according to the sample provided with the .net connector files and instead get this error. The page loads but after a while the debugger kicks in and I get the attached error.

[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using dhtmlxConnectors;
using System.Configuration;

namespace calendar.connector
{
///


/// Summary description for myconnector
///

public class myconnector : dhtmlxRequestHandler
{

    public override IdhtmlxConnector CreateConnector(HttpContext context)
    {
        return new dhtmlxSchedulerConnector(
           "dbo.events", //table to select from
            //"start_date,end_date,text", //fields to select 
           "id", //primary key column name
           dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type
           ConfigurationManager.ConnectionStrings["downtime"].ConnectionString //connection string
           , "start_date"
           , "end_date"
           , "text"
        );
    }
}

}[/code]

Also a more important question is that both samples do not show where to enter the user id and password to connect to the database. Where should that be specified?

Also I am using SQL Server 2008 R2, how should the dhtmlxDatabaseAdapaterType be changed to if it needs to be changed?

Best regards,

Brax


Hi,
dhtmlxDatabaseAdapterType shouldn’t be changed, SqlServer2005 is a correct value for all versions of MS SQLServer.

Regarding the exception - make sure you’ve specified a correct connection string to your database. Null reference exception may be caused by absence of ‘downtime’ connection string in your web config.

Try setting the connection string directly to the constructor, to see if the app would behave differentlyreturn new dhtmlxSchedulerConnector( "dbo.events", //table to select from //"start_date,end_date,text", //fields to select "id", //primary key column name dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type ConfigurationManager.ConnectionStrings["downtime"].ConnectionString //connection string , "start_date" , "end_date" , "text" );
–>

return new dhtmlxSchedulerConnector( "dbo.events", //table to select from //"start_date,end_date,text", //fields to select "id", //primary key column name dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type "Server=host;Database=database;uid=user;pwd=password" //connection string , "start_date" , "end_date" , "text" );

Hi Aliaksandr,

I’ve tried to set the connection string directly as suggested but am having this error regardless or how I am doing it.


Sorry, I clicked post before putting in the rest of the information. When I got the error attached in the previous post this is how I am specifying the connection string.

[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using dhtmlxConnectors;
using System.Configuration;

namespace calendar.connector
{
///


/// Summary description for myconnector
///

public class myconnector : dhtmlxRequestHandler
{

    public override IdhtmlxConnector CreateConnector(HttpContext context)
    {
        return new dhtmlxSchedulerConnector(
           "dbo.events", //table to select from
            //"start_date,end_date,text", //fields to select 
           "id", //primary key column name
           dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type
           "Server=server/instance;Database=downtime;uid=id;pwd=pw" //connection string
           , "start_date"
           , "end_date"
           , "text"
        );
    }
}

}[/code]

I’ve also tried the below variation and get the same error.

Server=//server/instance
Server=server

I tried the below method after checking out Google and get another error which won’t allow me to compile.

Server=\server\instance

How should I be specifying the server and instance the connection string?


Hi Aliaksandr,

I got the loading to work :smiley: , thanks a lot for your help. I specified it as “Server=server\instance”.

Unfortunately I am not able to save new events :frowning: . Should I be starting a new thread?

I included the dataprocessor call as below.

scheduler.load("/connector/myconnector.ashx") var dp = new dataProcessor("/connector/myconnector.ashx"); dp.init(scheduler);

New events I created are not saving, and one odd behavior is that after the initial load of page. Regardless of whether I create a new event or not if I click refresh the page tries to loading icon appears and does not go away.

I checked the guide here docs.dhtmlx.com/connector__net__dp.html and if I am including dhtmlxscheduler.js then I do not need to include dataprocessor.js right?

I was thinking of trying to include dataprocessor.js but I am not able to find dataprocessor.js in the scheduler or connector package.

Best regards,

Andrew