| |

VerySource

 Forgot password?
 Register
Search
Author: 摩羯可乐

Executing the stored procedure has no effect, but no error is reported, but the stored procedure executes normally in th

[Copy link]

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-13 12:30:02
| Show all posts
Are you sure that the stored procedure is executed? In addition, have all your variables got values?
You can use SqlCommand ("exec P_JISUAN_ZHCJ '1', '2', '3', '4'", m_conn);
Test with constants first ...
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

 Author| Post time: 2020-3-13 15:45:01
| Show all posts
cmd.CommandType = CommandType.StoredProcedure;
This execution shows that the stored procedure cannot be found
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

 Author| Post time: 2020-3-13 22:30:01
| Show all posts
Wait, i try
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-14 06:45:02
| Show all posts
public static bool DealData (params string [] QueryStrings) {
ConnectionString.Open ();
SqlTransaction SqlTrans = ConnectionString.BeginTransaction ();
SqlCommand Command = new SqlCommand ();
Command.Connection = ConnectionString;
Command.Transaction = SqlTrans;
try
{
for (int i = 0; i <QueryStrings.Length; i ++)
{
    Command.CommandText = QueryStrings [i];
    if (Command.ExecuteNonQuery () == 0)
    return false;
}
    SqlTrans.Commit ();
    return true;
}
catch
{
    SqlTrans.Rollback ();
    return false;
}
finally
{
    ConnectionString.Close ();
    Command.Dispose ();
}
}
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

 Author| Post time: 2020-3-14 11:00:01
| Show all posts
to:rcloud
Not working alone
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-14 13:45:01
| Show all posts
SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings ["CrmSqlConnect"];);
SqlCommand cmd = new SqlCommand ();
cmd.Connection = conn;
conn.Open ();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "p_corp_list_editresultcx";
cmd.Parameters.Add ("@ faid", SqlDbType.NVarChar (100)). Value = faid;
cmd.Parameters.Add ("@ bjid", SqlDbType.NVarChar (100))). Value = bjid;
.....
cmd.ExecuteNonQuery ();
SqlDataReader dr = cmd.ExecuteReader ();
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-14 15:15:01
| Show all posts
The above is wrong here ...
cmd.CommandText = "P_JISUAN_ZHCJ";
Reply

Use magic Report

0

Threads

29

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-3-14 23:45:01
| Show all posts
SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings ["CrmSqlConnect"]);
SqlCommand cmd = new SqlCommand ();
cmd.Connection = conn;
conn.Open ();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "p_corp_list_editresultcx";
cmd.Parameters.Add ("@ faid", SqlDbType.NVarChar) .Value = faid;
cmd.Parameters.Add ("@ bjid", SqlDbType.NVarChar) .Value = bjid;
cmd.Parameters.Add ("@ xsid", SqlDbType.NVarChar) .Value = xsid;
cmd.Parameters.Add ("@ error", SqlDbType.NVarChar) .Value = error;
cmd.ExecuteNonQuery ();
Reply

Use magic Report

0

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-15 09:45:01
| Show all posts
@ _ @
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

 Author| Post time: 2020-3-16 23:00:01
| Show all posts
Or not
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list