小编pot*_*ios的帖子

ExecuteNonQuery要求命令具有事务

我尝试执行以下代码时收到此错误消息.

ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议问题出在哪里?我想问题的根源是我尝试执行存储过程的部分.

存储过程在执行时创建自己的事务

 using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();

                SqlCommand command = conn.CreateCommand();
                SqlTransaction transaction;

                // Start a local transaction.
                transaction = conn.BeginTransaction("createOrder");

                // Must assign both transaction object and connection
                // to Command object for a pending local transaction
                command.Connection = conn;
                command.Transaction = transaction;

                try
                {
                    command.CommandText = "INSERT INTO rand_resupply_order (study_id, centre_id, date_created, created_by) …
Run Code Online (Sandbox Code Playgroud)

c# sql-server stored-procedures sql-server-2008

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

java.lang.NoClassDefFoundError: io/jsonwebtoken/SignatureAlgorithm

我有以下代码试图创建一个 jwt 令牌。每次尝试执行 SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256 时,总会出现如下所示的错误;

我已经手动删除了 jwt jar 文件并再次更新 maven 以重新安装 jar,但问题仍然存在。

任何帮助将不胜感激!

//Sample method to construct a JWT
public static String createJWT(String id, String issuer, String subject, 
        String payload, String role, String name, long ttlMillis) {
    String jwt = "";

    try {
        //The JWT signature algorithm we will be using to sign the token
        SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;

        long nowMillis = System.currentTimeMillis();
        Date now = new Date(nowMillis);

        //We will sign our JWT with our ApiKey secret …
Run Code Online (Sandbox Code Playgroud)

java jersey jwt

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

标签 统计

c# ×1

java ×1

jersey ×1

jwt ×1

sql-server ×1

sql-server-2008 ×1

stored-procedures ×1