由于错误而无法运行我的代码
找不到存储过程
但是我已经在SQL Server和Visual Studio中创建了它,我的所有连接都是正确的。
检查所有与代码和数据库的数据连接。
oWord = CreateObject("Word.Application")
If oWord IsNot Nothing Then
oWord.Visible = False
If oWord.Documents IsNot Nothing Then
Try
oDocument = oWord.Documents.Open(strFilePath)
Catch ex As Exception
iCouldntOpen += 1
bFailedToOpen = True
End Try
If Not bFailedToOpen Then
If oDocument IsNot Nothing Then
If oDocument.ReadOnly Then
iReadonly += 1
ElseIf oDocument.HasPassword Then
iPassword += 1
Else
For Each s As Style In oDocument.Styles
s.LanguageID = WdLanguageID.wdEnglishUK
Next
' save the document
oDocument.Save()
End If
' close the document
oDocument.Close()
oDocument = Nothing
End If
oWord.Quit()
oWord = Nothing
bFailedToOpen = False
End If
Else
iUnknown += 1
End If
Else
iUnknown += 1
End If
执行[WebMethod]
public static string getLogin(string email, string password)
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("sp_Register", con))
{
DataSet ds = new DataSet();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@txtemail", SqlDbType.VarChar).Value = email;
cmd.Parameters.Add("@txtpassword", SqlDbType.VarChar).Value = password;
cmd.Parameters.Add("@type", SqlDbType.VarChar).Value = "login";
cmd.Connection = con;
if (con.State == ConnectionState.Closed)
{
con.Open();
}
// con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.ExecuteNonQuery();
da.Fill(ds);
HttpContext.Current.Session["email"] = email;
return JsonConvert.SerializeObject(ds, Formatting.Indented);
}
}
}
返回一个异常:
找不到存储过程
答案 0 :(得分:0)
可能是权限问题,用于将应用程序连接到Db的用户与用于创建存储过程的用户相同吗?