이 코드가 작동하지 않는 이유는이 코드를 실행하고 싶습니다. vwd 2008 express이 오류 메시지를 표시합니다. 잘못된 개체 이름 'answers'.asp.net 저장 프로 시저 문제
이 내 ASCX.CS 코드 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Data.SqlClient;
using System.Configuration;
public partial class odgl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string connectionString =
@"SANATIZEDSTRING!!!!";
using (SqlConnection cn = new SqlConnection(connectionString))
{
using (SqlCommand dohvati = new SqlCommand("dbo.get_answers",cn)) {
dohvati.CommandType = CommandType.StoredProcedure;
SqlParameter izracun = new SqlParameter("@count", SqlDbType.Int);
izracun.Direction = ParameterDirection.Output;
dohvati.Parameters.Add(izracun);
cn.Open();
dohvati.ExecuteNonQuery();
int count = Int32.Parse(dohvati.Parameters["@count"].Value.ToString());
Response.Write(count.ToString());
cn.Close();
}
}
}
}
이 내 저장 프로 시저 입니다 :
문제는 프로 시저에 존재하는 것 같다set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[get_answers]
@ukupno int output
as
select @count= (SELECT COUNT(*) FROM answers)
go
에 연결 올바른 DB를 지정했는지 확인 모든 세계가 볼 수있는 사이트. –