|
Is it possible to make a direct connection to the database that the website is referencing?
That would make things simple.
|
|
|
|
|
I can make a direct connection, but the customers that will use the program won't be able to access the data through the firewall. I don't want to alter the firewall programming.
I'll figure it out.
|
|
|
|
|
I wrote a web service, and tied it to an asmx page.
Then I wrote a Serializable Class, with get and set, for the request and response.
In the web service, the input is the request class, and it outputs the response class. Used SQL Linq for the database calls.
Then in the Windows App, I created a service reference, using the WSDL that is generated when you add ?wsdl to the url. And in calling the service, I just changed the endpoint, and used basic http binding to test it.
So the class I need for the request and response are contained in the Service Reference.
And I just used those classes as a ListOf, to populate a listview control.
So I guess the whole thing happens with SOAP.
I'm impressed, had no idea it would be that easy to do. I've always consumed web services, but never wrote one. The ones I wrote were for JQuery, and returned JSON back to be parsed.
That is slick!
|
|
|
|
|
If it works, it's solved!
Most things are easy - once you know how to do them!
There's a well-known story about a mathematician giving a lecture - he's scribbling away on the blackboard, one equation after another, saying "and so it follows... (scribble scribble) therefore ... (scribble scribble)..." and then he gets to "..and thus it is obvious that (scribble scribble)" - then he pauses and adds "Well, I think it's obvious... hmm..." He stops and thinks for a bit, scratching his beard. Consults his books and notes - finally looks up triumphantly and exclaims "I was right! It is obvious!"
|
|
|
|
|
I like that, and I'm happy with it! Thanks
|
|
|
|
|
Hi!
I'm trying to write a simple ASP.NET program that read data from wcf service and displays the data in GridView. WCF service works fine. It has simple interface:
[OperationContract]
List<EmployeeDetails> GetEmoloyeesDetails();
[OperationContract]
string ChangeEmployeeDetails(EmployeeDetails employeeInfo);
[OperationContract]
string AddEmployeeDetails(EmployeeDetails employeeInfo);
[OperationContract]
string DeleteEmployeeDetails(EmployeeDetails employeeInfo);
EmployeeDetails is set of string objects:
[DataContract]
public class EmployeeDetails
{
string employeeID = string.Empty;
string firstName = string.Empty;
string lastName = string.Empty;
string birthDate = string.Empty;
[DataMember]
public string EmployeeID
{
get { return employeeID; }
set { employeeID = value; }
}
[DataMember]
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
[DataMember]
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
[DataMember]
public string BirthDate
{
get { return birthDate; }
set { birthDate = value; }
}
}
Now I create ASP.NET with GridView:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" Width = "550px" AutoGenerateColumns = "true" Font-Names = "Arial"
Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B"
HeaderStyle-BackColor = "green" AllowPaging ="true" ShowFooter = "true" PageSize = "10" onrowediting="EditEmployee"
onrowcancelingedit="CancelEdit">
<Columns>
<asp:TemplateField ItemStyle-Width = "30px" HeaderText = "FirstName">
<ItemTemplate>
<asp:Label ID="lblFirstName" runat="server"
Text='<%# Eval("FirstName")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField EditText="Edit" ShoweditButton="true" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
This is simple test code (aspx.cs):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{
ServiceReference1.StaffAccountingServiceClient proxy = new ServiceReference1.StaffAccountingServiceClient();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
GridView1.DataSource = proxy.GetEmoloyeesDetails();
GridView1.DataBind();
}
protected void EditEmployee(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindData();
}
protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BindData();
}
}
}
I launch my ASP.NET client, and click on Edit link. And I see that dynamically created columns is in edit mode, but staticaly created columns is not
I need to create a static table with the ability to edit. This is example what I want to do:
http://www.aspsnippets.com/Articles/Simple-Insert-Select-Edit-Update-and-Delete-in-ASPNet-GridView-control.aspx[^]
The difference is that I use WCF service to interact with data base.
Please, help me! What could be the problem?
Thanks!
modified 29-Nov-15 12:38pm.
|
|
|
|
|
Greetings experts,
I am not sure what forum to post this question.
So, naturally, I decided to post it on the forum I am a bit more familiar with but I can do this with script, asp, php whichever technology helps me accomplish this.
We would like to programmatically read the contents of logs in referenced on the subject line.
Particularly, we are interested in getting counts of site visits, pages visited, etc from the logs.
This task would have been easier if we had access to the codebehind of the web app built by a vendor.
Only the markup is accessible.
So far, we have been able to get this information from the logs manually and are looking for an opportunity to do this programmatically so our users can get the information they need more easily.
Your assistance is greatly appreciated.
modified 25-Nov-15 12:11pm.
|
|
|
|
|
Microsoft's Log Parser[^] works quite well.
Unfortunately, the site with the documentation[^] seems to be down at the moment. However, Log Parser Studio[^] gives you a GUI which should get you started.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello Richard,
*Always* great to hear from you.
I actually installed that software yesterday but had no idea how to connect it to a remote server.
I uninstalled it.
I am going to attempt to install it again and perhaps you can guide me on how to use it?
Thanks as always.
|
|
|
|
|
The fact that you are doing this remotely is a fairly important piece of information you should have included in your original question.
If you want to access the files remotely you'll need to do it via a UNC, which is the format you use to reference files over a network. If the files are at c:\inetpub\wwwroot\logs on a machine called "MyIIS" then you can access that folder from another machine using \\MyIIS\c$\inetpub\wwwroot\logs. This will need admin rights on the target machine. An alternative is to explicitly share the logs folder so you can control the access rights and use \\MyIIS\logs
|
|
|
|
|
As F-ES Sitecore said, you should be able to use a UNC path, so long as you have permission to access it.
There's a series on blog posts on SimpleTalk which might help:
Part 1[^]
Part 2[^]
Part 3[^]
Part 4[^]
Part 5[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard and F-ES Sitecore,
It appears to be working now.
Thanks to you guys for the tips.
It feels really good to know that I can count on wonderful helpers like you guys.
Thank you
|
|
|
|
|
I am using Linq query to pull the latest 3 dates for a given record: EEGRP, EID.
However I am having issues when adding a new row into new table with non key columns:
result.Rows.Add .... item.EENAML.. etc.
Could you tell me what I am doing incorrect?
Dim data = myDataTable.AsEnumerable().GroupBy(Function(r) New With {Key .EEGRP = r.Field(Of String)("EEGRP"), Key .EESSN = r.Field(Of String)("EID")},
Function(key, rows) New With
{
Key .EEGRP = key.EEGRP,
Key .ESSN = key.EID,
.Dates = rows.Select(Function(r) r.Field(Of DateTime?)("DEIBCY") & ("DIIBYR") & ("D.DIIBMT") & ("DEIBDY")) _
.OrderByDescending(Function(d) d).Take(3).ToList()
})
Dim result As New DataTable
result = myDataTable.Clone()
For Each item In data
result.Rows.Add(item.EEGRP,item.EID, item.EENAML,item.EENAMF,item.EENAMM,item.EEADD1,item.EEADD2,,,, _
|
|
|
|
|
async and await method not suitable in heavy traffic website
|
|
|
|
|
Was there supposed to be a question hiding in there somewhere?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Not a question. However, if it were a question regarding what can a heavy traffic website handle the answer would still be "it depends." Availability and responsiveness are dependent on many different factors including the performance of IIS and then also of the sql db and the network. Many, many, different factors.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello,
i am novice in asp.net and i want to write an sql query that will calculate student grade and grade point base on the condition bellow.
WHEN EXAMS BETWEEN 75 AND 100 THEN 'A'
WHEN EXAMS BETWEEN 70 AND 74 THEN 'AB'
WHEN EXAMS BETWEEN 65 AND 69 THEN 'B'
WHEN EXAMS BETWEEN 60 AND 64 THEN 'BC'
WHEN EXAMS BETWEEN 55 AND 59 THEN 'C'
WHEN EXAMS BETWEEN 50 AND 54 THEN 'CD'
WHEN EXAMS BETWEEN 45 AND 49 THEN 'D'
WHEN EXAMS BETWEEN 40 AND 44 THEN 'E'
WHEN EXAMS BETWEEN 40 AND 0 THEN 'F'
please how can i do this query, than you
|
|
|
|
|
I dont see what your question has to do with ASP.Net - and you've posted it in two different places. In future pick ONE forum and post there please
|
|
|
|
|
I am using a stored procedure in entity framework its returning two columns in sql server but when i am using in entity framework its returning no column please do needful.
modified 21-Nov-15 2:16am.
|
|
|
|
|
Er. Aamir Khan KCNIT Banda wrote: please do needful. What needful?
|
|
|
|
|
Entity framework returns no columns but in sql its returning.?
USE [UPOR_DE_MAIN]
GO
/****** Object: StoredProcedure [dbo].[usp_s_UDMFieldChaltaNos] Script Date: 11/20/2015 12:29:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- usp_s_UDMFieldChaltaNos 26,4,2,15,66,16207,'','','','','','',''
-- usp_s_UDMFieldChaltaNos 26,4,2,15,66,16207,'','','','','','',''
ALTER PROCEDURE [dbo].[usp_s_UDMFieldChaltaNos]
@DistrictCode int
,@TalukCode int
,@TownId int
,@ZoneId int
,@SectorId int
,@BlockId int
,@HouseNo nvarchar(50)
,@WardId int
,@PropertyNumber nvarchar(50)
,@DivisionNo nvarchar(50)
,@LocalAreaNoId int
,@PTSheetId int
,@CitySurveyNo nvarchar(50)
--satya--
as
begin
declare @par nvarchar(max)
declare @parMain nvarchar(max)
--SubChaltaNo is null and
set @par= ' where DistrictCode=' + convert(nvarchar(3),@DistrictCode)
set @parMain= ' where a.DistrictCode=' + convert(nvarchar(3),@DistrictCode)
set @par=@par + ' and TalukCode=' + convert(nvarchar(3),@TalukCode)
set @parMain=@parMain + ' and a.TalukCode=' + convert(nvarchar(3),@TalukCode)
set @par=@par + ' and TownId=' + convert(nvarchar(3),@TownId)
set @parMain=@parMain + ' and a.TownId=' + convert(nvarchar(3),@TownId)
set @par=@par +' and ChaltaId not in (select ChaltaId from UPOR_Property_Main where
DistrictCode='+ convert(nvarchar(3),@DistrictCode) +' and TalukCode='
+ convert(nvarchar(3),@TalukCode) +' and TownId= '+ convert(nvarchar(3),@TownId) +') '
if @ZoneId<>0
begin
set @par=@par + ' and ZoneId=' + convert(nvarchar,@ZoneId)
set @parMain=@parMain + ' and ZoneId=' + convert(nvarchar,@ZoneId)
end
if @SectorId<>0
begin
set @par=@par + ' and SectorId=' + convert(nvarchar,@SectorId)
set @parMain=@parMain + ' and SectorId=' + convert(nvarchar,@SectorId)
end
if @BlockId<>0
begin
set @par=@par + ' and BlockId=' + convert(nvarchar,@BlockId)
set @parMain=@parMain + ' and BlockId=' + convert(nvarchar,@BlockId)
end
if @WardId<>0
begin
set @par=@par + ' and WardId=' + convert(nvarchar,@WardId)
set @parMain=@parMain + ' and WardId=' + convert(nvarchar,@WardId)
end
if @LocalAreaNoId<>0
begin
set @par=@par + ' and LocalAreaNoId=' + convert(nvarchar,@LocalAreaNoId)
set @parMain=@parMain + ' and LocalAreaNoId=' + convert(nvarchar,@LocalAreaNoId)
end
if @PTSheetId<>0
begin
set @par=@par + ' and PTSheetId=' + convert(nvarchar,@PTSheetId)
set @parMain=@parMain + ' and PTSheetId=' + convert(nvarchar,@PTSheetId)
end
if @HouseNo<>''
begin
set @par=@par + ' and HouseNo = ' + char(39) + @HouseNo + char(39)
set @parMain=@parMain + ' and HouseNo = ' + char(39) + @HouseNo + char(39)
end
if @PropertyNumber<>''
begin
set @par=@par + ' and PropertyNumber = ' + char(39) + @PropertyNumber + char(39)
set @parMain=@parMain + ' and PropertyNumber = ' + char(39) + @PropertyNumber + char(39)
end
if @CitySurveyNo<>''
begin
set @par=@par + ' and CitySurveyNo = ' + char(39) + @CitySurveyNo + char(39)
set @parMain=@parMain + ' and CitySurveyNo = ' + char(39) + @CitySurveyNo + char(39)
end
set @par=@par + ' and isdeleted is null'
set @parMain=@parMain + ' and Type=''S''
and a.MainChaltaId in (select chaltaid from dbo.UPOR_Property_Main)
and a.MainChaltaId=b.chaltaid
and a.chaltaid not in (select chaltaid from dbo.UPOR_Property_Main) and isDeleted is null'
--(case when AdditionalNo IS Null then convert(varchar,ChaltaNo) else convert(varchar,ChaltaNo) +'+'''/''' +'+ AdditionalNo end )as ChaltaNo
--convert(varchar,isnull(AdditionalNo,'''')) as ChaltaNo
declare @query nvarchar(max)
declare @queryMain nvarchar(max)
set @query= 'select ChaltaId,
(Case when Additionalno is null and subchaltano is null then convert(varchar,chaltano)
when Additionalno is not null and subchaltano is null then convert(varchar,chaltano) +'+'''/'''+'+ additionalno
when Additionalno is null and subchaltano is not null then convert(varchar,chaltano) +'+'''-'''+'+ convert(varchar,subchaltano)
else convert(varchar,chaltano) +'+'''/'''+'+ additionalno +'+'''-'''+'+ convert(varchar,subchaltano) end) as ChaltaNo
from UPOR_ChaltaMain'
-- convert(varchar,isnull(AdditionalNo,''''))
--as ChaltaNo
set @queryMain=' UNION select distinct a.chaltaid,
(Case when a.Additionalno is null and a.subchaltano is null then convert(varchar,a.chaltano)
when a.Additionalno is not null and a.subchaltano is null then convert(varchar,a.chaltano) +'+'''/'''+'+ a.additionalno
when a.Additionalno is null and a.subchaltano is not null then convert(varchar,a.chaltano) +'+'''-'''+'+ convert(varchar, a.subchaltano)
else convert(varchar,a.chaltano)+'+'''/'''+'+ a.additionalno +'+'''-'''+'+ convert(Varchar,a.subchaltano) end) as ChaltaNo
from UPOR_ChaltaMain as a,UPOR_Property_Main as b'
set @queryMain=@queryMain + @parMain
set @query=@query+@par
set @query = @query + @queryMain
--where
-- DistrictCode='+ convert(varchar,@census_dist_code) +' and TalukCode='+ convert(varchar,@census_taluk_code) +'
-- and TownId=' + convert(varchar,@TownId) + convert(varchar,@WhrVal)
declare @queryUNION nvarchar(max)
set @queryUNION='select distinct chaltaid,ChaltaNo from ('+@query+') as c '+' where ChaltaId !=0 '
print (@queryUNION)
exec (@queryUNION)
end
--
|
|
|
|
|
Don't post in multiple areas. It's considered rude.
As I told you in QA, your problem is that the sql is dynamic so the number of return columns cannot be determined ahead of time. Use something other than EF for this one.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have Visual Studio 2010 Professional which should have the chart control in the toolbox. It is checked as being in the toolbox for both web forms and windows forms, but it is not showing. Is there some way to fix this? My projects are VB.
Bobby
|
|
|
|
|
You could always try adding it anyway in to your page and see if it takes or if you get an error that might tell you what is happening.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Ryan,
Thank you. I resolved the issue thus: Loaded Visual Web Developer 2008 and added chart control to the toolbox. Opened VS 2010, unchecked chart controls from the Add Controls Dialog. Then added them back. Voila! Now the chart control appears in the vs 2010 toolbox.
Windows update kept trying to install update for the control, and failed for 5 days. Now the update should work. Hope this helps anyone who is experiencing a similar problem.
Bobby
|
|
|
|
|