here is my code ,but connect to database error:
[HttpPost]
[Route("api/handler")]
public IActionResult Handler(CommandJson command)
{
Result result = new Result();
if (command.Database == "MySQL") result = MySQLAdapter.Process(command);
if (command.Database == "Firebird") result = FirebirdAdapter.Process(command);
if (command.Database == "MS SQL") result = MSSQLAdapter.Process(command);
if (command.Database == "PostgreSQL") result = PostgreSQLAdapter.Process(command);
return new ObjectResult(result);
}
How to use JS Designer in the ASP.NET CORE (NET 461)?
-
- Posts: 13
- Joined: Thu Feb 23, 2017 9:55 am
-
- Posts: 13
- Joined: Thu Feb 23, 2017 9:55 am
Re: How to use JS Designer in the ASP.NET CORE (NET 461)?
Nothing worse than that.
I solved the problem myself from use my custom adapter in asp.net core .
by the way, the sample adapter for asp.net is very bad!!!!
here is my solution :
1.modify asp.net core project ,support text/plain content type.
2.use post and entity class serilize object .
3.use custom adapter ( its very import for that, could not use static Adapter class !!!)
like this:
public class MSSQLAdapter
{
public Result Process(CommandJson command)
{
var connection = new SqlConnection(command.ConnectionString);
connection.Open();
try
{
if (!String.IsNullOrEmpty(command.QueryString))
{
var sqlCommand = new SqlCommand(command.QueryString, connection);
var reader = sqlCommand.ExecuteReader();
var columns = new List<string>();
var rows = new List<string[]>();
for (var index = 0; index < reader.FieldCount; index++)
{
columns.Add(reader.GetName(index));
}
while (reader.Read())
{
var row = new string[reader.FieldCount];
for (var index = 0; index < reader.FieldCount; index++)
{
object value = null;
if (!reader.IsDBNull(index)) value = reader.GetValue(index);
if (value == null) value = "";
row[index] = value.ToString();
}
rows.Add(row);
}
return new Result { Success = true, Columns = columns.ToArray(), Rows = rows.ToArray() };
}
else
{
return new Result { Success = true };
}
}
catch (Exception e)
{
return new Result { Success = false, Notice = e.Message };
}
finally
{
if (connection.State != ConnectionState.Closed)
{
connection.Close();
}
}
}
}
use:
[HttpPost]
[Route("api/handler")]
public IActionResult Handler(CommandJson command)
{
Result result = new Result();
if (command.Database == "MS SQL") result = new MSSQLAdapter().Process(command);
return new ObjectResult(result);
}
fuck!!!
I solved the problem myself from use my custom adapter in asp.net core .
by the way, the sample adapter for asp.net is very bad!!!!
here is my solution :
1.modify asp.net core project ,support text/plain content type.
2.use post and entity class serilize object .
3.use custom adapter ( its very import for that, could not use static Adapter class !!!)
like this:
public class MSSQLAdapter
{
public Result Process(CommandJson command)
{
var connection = new SqlConnection(command.ConnectionString);
connection.Open();
try
{
if (!String.IsNullOrEmpty(command.QueryString))
{
var sqlCommand = new SqlCommand(command.QueryString, connection);
var reader = sqlCommand.ExecuteReader();
var columns = new List<string>();
var rows = new List<string[]>();
for (var index = 0; index < reader.FieldCount; index++)
{
columns.Add(reader.GetName(index));
}
while (reader.Read())
{
var row = new string[reader.FieldCount];
for (var index = 0; index < reader.FieldCount; index++)
{
object value = null;
if (!reader.IsDBNull(index)) value = reader.GetValue(index);
if (value == null) value = "";
row[index] = value.ToString();
}
rows.Add(row);
}
return new Result { Success = true, Columns = columns.ToArray(), Rows = rows.ToArray() };
}
else
{
return new Result { Success = true };
}
}
catch (Exception e)
{
return new Result { Success = false, Notice = e.Message };
}
finally
{
if (connection.State != ConnectionState.Closed)
{
connection.Close();
}
}
}
}
use:
[HttpPost]
[Route("api/handler")]
public IActionResult Handler(CommandJson command)
{
Result result = new Result();
if (command.Database == "MS SQL") result = new MSSQLAdapter().Process(command);
return new ObjectResult(result);
}
fuck!!!
Re: How to use JS Designer in the ASP.NET CORE (NET 461)?
Hello.
You don't need to make any changes in the database adapters.
Just specify the path to it.
What version of our product do you use?
There is no JS engine on our current builds of .Net Core components.
Thank you.
You don't need to make any changes in the database adapters.
Just specify the path to it.
What version of our product do you use?
There is no JS engine on our current builds of .Net Core components.
Thank you.
-
- Posts: 13
- Joined: Thu Feb 23, 2017 9:55 am
Re: How to use JS Designer in the ASP.NET CORE (NET 461)?
thank you very much.HighAley wrote:Hello.
You don't need to make any changes in the database adapters.
Just specify the path to it.
What version of our product do you use?
There is no JS engine on our current builds of .Net Core components.
Thank you.
But, once again,we use JS Designer in asp .Net Core . version 18.2 Trial
so,we have to modify adaper .
now,JS Designer run in asp .Net Core project perfect .
finally ,hope .Net Core official sample with js Designer .
-
- Posts: 6265
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to use JS Designer in the ASP.NET CORE (NET 461)?
Hello,
Thank you for the information.
We have added this task in our to-do list.
Thank you.
Thank you for the information.
We have added this task in our to-do list.
Thank you.
-
- Posts: 6265
- Joined: Tue Mar 20, 2018 5:34 am
Re: How to use JS Designer in the ASP.NET CORE (NET 461)?
Hello,
Also, you can use our native Core components:
https://github.com/stimulsoft/Samples-N ... MVC-CSharp
Thank you.
Also, you can use our native Core components:
https://github.com/stimulsoft/Samples-N ... MVC-CSharp
Thank you.