A
ahmeddc
Guest
hi
I want to call all the table data on the web service
stored procedure
ALTER proc [dbo].[select_data] (
@active bit)
as
select * from data_tb WHERE active=@active
--add
web service
//get data
[WebMethod]
public DataTable Getdata()
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("select_data", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@active", SqlDbType.Bit).Value = true;
if (con.State != ConnectionState.Open)
{
con.Open();
}
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmd;
adp.Fill(dt);
dt.TableName = "data_tb";
if (con.State == ConnectionState.Open)
{
con.Close();
}
}
}
return dt;
}
my try
DataTable dt = new DataTable();
dt = _service.Getdata();
if (dt.Rows.Count > 0)
{
dataGridView1.DataSource = dt;
}
The code shows the data in the table if the data is string, and if there are pictures in the columns
of the table and date , the following error appears
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
Continue reading...
I want to call all the table data on the web service
stored procedure
ALTER proc [dbo].[select_data] (
@active bit)
as
select * from data_tb WHERE active=@active
--add
web service
//get data
[WebMethod]
public DataTable Getdata()
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("select_data", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@active", SqlDbType.Bit).Value = true;
if (con.State != ConnectionState.Open)
{
con.Open();
}
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmd;
adp.Fill(dt);
dt.TableName = "data_tb";
if (con.State == ConnectionState.Open)
{
con.Close();
}
}
}
return dt;
}
my try
DataTable dt = new DataTable();
dt = _service.Getdata();
if (dt.Rows.Count > 0)
{
dataGridView1.DataSource = dt;
}
The code shows the data in the table if the data is string, and if there are pictures in the columns
of the table and date , the following error appears
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
Continue reading...