|
Completely agree with my friend's comment above.
But assuming that you are new to this world, be my guest and have a look into this article.
http://www.codeproject.com/Articles/631668/Learning-MVC-Part-Repository-Pattern-in-MVC-App
But please from next time, time to do some basic research first.
|
|
|
|
|
HI,
I want to know that What is anonymous method in C# and it's use???
|
|
|
|
|
|
have a look into this
http://www.codeproject.com/Articles/47887/C-Delegates-Anonymous-Methods-and-Lambda-Expressio
|
|
|
|
|
hi , for example i have a table named (name)
and a form with a text box and a add button.
i wanna know how do i transfer the data from the textbox into the table( sql server express 2012 , and visual studios 2015 Rc)
sql connecton ......
sqlcommand cmd = new sqlcommand("insert into* .......... <- the part im struggling with
|
|
|
|
|
|
thanks il quickly take a look there
|
|
|
|
|
Have you bought the C# book you were recommended yet?
|
|
|
|
|
not yet my finances are kinda flat up now
|
|
|
|
|
So what structured resources are you following to learn C# properly?
|
|
|
|
|
i got a few pdfs i read thru that i got from my friend studying c# ,
|
|
|
|
|
There's a really good free PDF-book on programming in C#, which you can download here: http://www.introprogramming.info/[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
thanks man
|
|
|
|
|
You should get a decent idea of what needs to be done, here[^]. Look at the first answer to get an idea on how to do this without leaving your code vulnerable to SQL Injection Attacks.
|
|
|
|
|
Hi,
I want to fetch data from SQL database, and display the same on my HTML page in table format using Angular JS.
I am able to get the data in the scope variable, but it is not getting displayed in the HTML page.
Please check the code that I have written below, and help me fixing the issue.
Thanks in advance.
HTML code:
<!DOCTYPE html>
<html>
<head>
<title>:: View Logs ::</title>
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular.min.js"></script>
<!--<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>-->
<script src="Scripts/logsController.js"></script>
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-2.1.1.min.js"></script>
<!--<script>
ViewLogsApp = angular.module('ViewLogsApp', []);
ViewLogsApp.controller('ViewLogsController', function ($scope, $http) {
$http.get('data.json').success(function (response) {
$scope.myData = response;
});
});
</script>-->
</head>
<body>
<div ng-app="ViewLogsApp">
<div ng-controller="ViewLogsController">
<table class="table table-striped">
<tr>
<th>Log ID</th>
<th>User Type</th>
<th>User Name</th>
<th>Email ID</th>
<th>Action Type</th>
<th>Section Name</th>
<th>Section Details</th>
<th>DateTime</th>
<th>User IP</th>
</tr>
<tr ng-repeat="item in logslist">
<td>{{item.LogID}}</td>
<td>{{item.UserType}}</td>
<td>{{item.UserName}}</td>
<td>{{item.EmailID}}</td>
<td>{{item.ActionType}}</td>
<td>{{item.SectionName}}</td>
<td>{{item.SectionDetails}}</td>
<td>{{item.DateTime}}</td>
<td>{{item.UserIP}}</td>
</tr>
</table>
</div>
</div>
</body>
</html>
logsController.js code:
angular.module('ViewLogsApp', [])
.controller('ViewLogsController', [
'$scope', function ($scope) {
$scope.logslist = [];
$scope.load;
$scope.load = function () {
$.ajax({
type: 'GET',
contentType: 'application/json; charset=utf-8',
url: 'UserActivityLogs.aspx/getList',
success: function (data) {
$scope.logslist = data
$scope.$apply();
}
});
}
$scope.load();
}
]);
WebMethod code:
[System.Web.Services.WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static List<UserActivityLogsList> getList()
{
SqlConnection con = new SqlConnection();
con.ConnectionString = _connstr;
con.Open();
var logs = new List<UserActivityLogsList>();
string get = "select * from UserActivityLogs";
SqlCommand cmd = new SqlCommand(get, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
UserActivityLogsList e = new UserActivityLogsList();
e.LogID = Convert.ToInt32(dr[0]);
e.UserType = Convert.ToString(dr[1]);
e.UserName = Convert.ToString(dr[2]);
e.EmailID = Convert.ToString(dr[3]);
e.ActionType = Convert.ToString(dr[4]);
e.SectionName = Convert.ToString(dr[4]);
e.SectionDetails = Convert.ToString(dr[4]);
e.DateTime = Convert.ToString(dr[4]);
e.UserIP = Convert.ToString(dr[4]);
logs.Add(e);
}
con.Close();
return logs;
}
Clouds come floating into my life, no longer to carry rain or usher storm, but to add color to my sunset sky. ~Rabindranath Tagore
|
|
|
|
|
This is not a C# issue. Please use the ASP.NET or Javascript forum, as appropriate.
|
|
|
|
|
So I'm using this command to open a picture in C sharp
Process.Start(@"C:\MyPicture.jpg");
Is there anyway I can open the latest picture in the folder?
|
|
|
|
|
Yes. You could iterate over all the picture files in the directory, looking at the file attributes for the files. That should help you find the latest.
|
|
|
|
|
var directory = new DirectoryInfo(@"C:\");
var latest = (from f in directory.EnumerateFiles("*.jpg")
orderby f.CreationTime
select f.FullName).LastOrDefault();
Console.WriteLine(latest);
Returns null in case there are no jpg files found.
|
|
|
|
|
I am trying to complete a standalone *.exe file that will simply allow read and write FirstSlideNumber property in a PowerPower 2013 pptx file, without opening PowerPoint. (VS 2015).
My application can find the file name etc. but as I am new to C# after returning to programming after 10 years, I need a code fragment example in C#
https://msdn.microsoft.com/EN-US/library/office/ff744279.aspx is VBA is no help.
This is my code fragment:
using System;
using System.IO;
using System.Windows.Forms;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Presentation;
using Microsoft.Office.Interop.PowerPoint;
using Powerpoint = Microsoft.Office.Interop.PowerPoint;
…
//file Open file
using (PresentationDocument mypptx = PresentationDocument.Open(myFileName, true))
{
Int iFirstSlideNumber = PageStepup?? //PageStepup. Only allows “Equals” or “ReferenceEquals”
}
|
|
|
|
|
|
Of which type is "PageStepup"? Where is it declared?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Error : Must declare the scalar variable "@id".
|
|
|
|
|
Member 11864285 wrote: Must declare the scalar variable "@id".
Most likely because you did not declare the variable @id. But that is just a guess since you decided not to share the code that is causing the error.
You can lead a developer to CodeProject, but you can't make them think.
The Theory of Gravity was invented for the sole purpose of distracting you from investigating the scientific fact that the Earth sucks.
|
|
|
|
|
Your SQL-statement contains a parameter named @id which you didn't supply to the command object. Most probably.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|