小编Dev*_*404的帖子

将日期转换为dd-mm-yyyy格式

如何将日期(12/24/2009 12:48:00 PM)转换为格式dd-mm-yy?

我尝试了以下代码:

DateTime.TryParse(12/24/2009 12:48:00 PM,out registereddate);
  strregdate = registereddate.ToString("dd-mm-yyyy");
Run Code Online (Sandbox Code Playgroud)

但是,产量为24-48-2009.如何转换

c# asp.net datetime-format

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

如何禁用发布和分发?

我在禁用发布和分发时遇到以下错误.Plz,告诉我如何禁用发布和分发?

SQL Server无法禁用"服务器"上的发布和分发.

执行Transact-SQL语句或批处理时发生异常.(Microsoft.SqlServer.ConnectionInfo)

分销商未正确安装.无法禁用数据库以进行发布.将数据库上下文更改为"master".(Microsoft SQL Server,错误:20029)

sql-server-2008 merge-replication

0
推荐指数
1
解决办法
7096
查看次数

Spring boot - 服务器无法识别 HTTP Header SOAPAction 的值

我想使用 jaxb 使用肥皂服务。jaxb 生成的请求是

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
      <ns2:Add xmlns:ns2="http://tempuri.org/">
         <ns2:intA>10</ns2:intA><ns2:intB>20</ns2:intB>
      </ns2:Add>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

但是响应是标题中所述的soap异常。

Caused by: org.springframework.ws.soap.client.SoapFaultClientException: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
Run Code Online (Sandbox Code Playgroud)

下面是我的肥皂配置代码。源码示例:https : //howtodoinjava.com/spring-boot/spring-soap-client-webservicetemplate/

    public class ConsumeSoapApplication {
            public static String wsdlurl = "http://www.dneonline.com/calculator.asmx?wsdl";
            public static void main(String[] args) {
                try {
                    JAXBContext.newInstance(com.dxc.service.soap.service.calc.ObjectFactory.class.getPackage().getName(),
                            com.dxc.service.soap.service.calc.ObjectFactory.class.getClassLoader());
                } catch (JAXBException e) {
                    // TODO Auto-generated catch block …
Run Code Online (Sandbox Code Playgroud)

soap web-services jaxb jaxb2-maven-plugin spring-boot

0
推荐指数
1
解决办法
2487
查看次数

当 autocommit=true 时无法调用提交

您好,我正在使用 jhipster 生成的代码,其依赖项为 3.0.7。我正在尝试使用下面的代码对数据库密码进行自定义加密和解密。我调试时解密成功,但是在本机服务器会话中,我可以看到自动提交设置为 true,这是错误的原因。默认自动提交粘贴了下面的错误。看起来 hikari 自动提交没有设置或者什么的。这个和mysql没有关系。com.mysql.cj.protocol.a 中有一个名为 NativeServerSession 的类,它将自动提交设置为 true,从而导致错误。我尝试在 yml 文件中将自动提交设置为 true 。但我得到了同样的错误。请帮忙。如果我删除加密并删除数据库配置类,它就会起作用,并且 NativeServerSession 自动提交也设置为 true。

@Configuration
@ConfigurationProperties(prefix = "spring.datasource")
@EnableJpaRepositories("com.my.repository")
@EnableTransactionManagement
@EnableJpaAuditing
public class DatabaseConfiguration extends DriverManagerDataSource implements InitializingBean  {

    @Override
    public void afterPropertiesSet() throws Exception {
        this.decryptPass();
        
    }
    
    @Bean
    public void decryptPass() {
        String retrievedPassword = this.getPassword();
        ..decrpt code goes here
        this.setPassword(decryptedDBPassword);          
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序.yml

datasource:
    #driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.zaxxer.hikari.HikariDataSource
    default-auto-commit: false
    auto-commit: false
    url: jdbc:mysql://localhost:3306/mydatabase?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&relaxAutoCommit=true
    username: dbusername
    password: encryptedpassword
    hikari:
      poolName: Hikari
      auto-commit: false
      default-auto-commit: …
Run Code Online (Sandbox Code Playgroud)

mysql spring-data mssql-jdbc spring-data-jpa jhipster

0
推荐指数
1
解决办法
3292
查看次数

在Datalist中分页

如何在Datalist中进行分页.我需要页码如下:

<1 2 3 4 5>点击'>'后5页应该显示...

让我清除我的编码流程......我将使用存储过程和整个记录从数据库中获取列表.然后,根据页数,应显示页码.我只需要在页面中显示有限数量的页码.当我点击下一个按钮时,应显示下一组页码.我的存储过程将返回数据集.这是我的Paging代码..

private void doPaging(){

    DataTable dt = new DataTable();
    dt.Columns.Add("PageIndex");
    dt.Columns.Add("PageText");
    for (int i = 0; i <= totalpage; i++)
    {
        DataRow dr = dt.NewRow();
        dr[0] = i;
        dr[1] = i + 1;
        dt.Rows.Add(dr);
    }

    dlPaging.DataSource = dt;
    dlPaging.DataBind();
}
Run Code Online (Sandbox Code Playgroud)

此代码将在页面中显示所有页码.相反,我只需要显示一次页面编号.当我单击下一个按钮时,应显示下一个5页码.

paging

-3
推荐指数
1
解决办法
1931
查看次数