Click here to Skip to main content
15,890,947 members
Everything / Syntax

Syntax

syntax

Great Reads

by Britto selva pandian J
Things to remember while using Rest API calls on SharePoint hosted App for Office 365/SharePoint Online
by Pete O'Hanlon
How to use arrays to manage multiple items
by Pete O'Hanlon
What is an array and how to use it to manage multiple items
by ASP.NET Community
IntroductionLINQ is one of the new entrants in C# 3.0, introduced as part of .NET 3.5. As you are already aware, LINQ is a unified querying

Latest Articles

by Pete O'Hanlon
How to use arrays to manage multiple items
by Christian Specht
Overlay gallery images with logo using one of Hugo's available image filters
by Jon Randy
Safe monkey-patching for JavaScript
by Pete O'Hanlon
What is an array and how to use it to manage multiple items

All Articles

Sort by Score

Syntax 

28 Sep 2014 by Bernhard Hiller
It might be caused by the use of keywords as column names - most likely candidate is Date. Try to "escape" all column names: sql = "INSERT into tbl_Record ([Name],[Date],[Toothno],[Procedure],[Amount_Charged],[Amount_Paid],[Balance],[IDrecord]) values (@Name, @Date, @Toothno, @Procedure,...
6 Dec 2012 by Richard MacCutchan
Post your question in the forum at the end of the article so the author can see it and respond.
4 Jul 2013 by thanh_bkhn
This code is similar with$carModel = $_POST['carModel'];$year = $_POST['year'];$bodyStyle = $_POST['bodyStyle'];
8 Jul 2013 by woopsydoozy
I hit that at some point, too. Crystal Reports formulas evidently operate with 1-based arrays instead of 0, so the problem's in your loop. Try:For i := 1 To 10 Do( Source=Replace(Source,Find[i],ReplaceWith[i]););
16 Sep 2014 by Sergey Alexandrovich Kryukov
Your approach is wrong from the very beginning. You should never create a query by concatenation of string taken from your UI. Instead, you need to use parametrized statements. Please see: http://msdn.microsoft.com/en-us/library/ff648339.aspx[^].If you do it your way, you make your...
1 Sep 2015 by Abhinav S
WhereQuery is Nothing initially. When you append a condition to the query you need a WHERE first. Here, you are using an AND 1) without a WHERE2) without any other where filter in the queryThis might solve your problemIf Requester Nothing Then IF WhereQuery Nothing Then ...
1 Sep 2015 by Suvendu Shekhar Giri
Change this line Dim WhereQuery As String = NothingtoDim WhereQuery As String = " WHERE 1=1"Hope it helps :)
20 Apr 2016 by ZurdoDev
As Richard pointed out, don't do it this way. Not only does it lead to syntax issues but it is very easy to hack your db when you write code this way. Instead do like this:Dim q As String = "UPDATE Table1 SET " & "FirstName=@FirstName" & "',SecondName=@SecondName" &...
1 Sep 2017 by Britto selva pandian J
Things to remember while using Rest API calls on SharePoint hosted App for Office 365/SharePoint Online
24 May 2019 by User 11060979
You start with an else if else if($contact == "entered_email_adress@yourdomain.com") I think it should be more only an if if($contact == "entered_email_adress@yourdomain.com") Note: I'm not experienced in php... [Edit] Think also about if no condition matches. In this case you should not...
24 May 2019 by jsc42
You have 4 'else if' statements but there is no initial 'if' statement. Your code should look something like ...
12 Jul 2019 by Richard Deeming
As discussed in the comments, the code you've shown is correct, and the bug has now disappeared. Demo: Optional Xml | C# Online Compiler | .NET Fiddle[^]
1 Oct 2019 by Richard Deeming
Simple - just remove the async keyword: protected virtual Task MyFunction() { return Task.FromResult(string.Empty); } If your task completes synchronously most of the time, you might want to consider using ValueTask instead. Understanding the Whys, Whats, and Whens of ValueTask |...
22 Jun 2020 by Patrice T
Quote: Can't find syntax error anywhere in code Syntax error is in SQL command I would start with: SQL = "INSERT INTO Employee (Email, First_name, Last_name, Phone, Admin, Active)" ' ...
23 Jul 2020 by OriginalGriff
Dim s As String = "a" + ChrW(&HD800) + "b" Dim t As String = s.Normalize() The reason it fails is that "D800" is not a valid Unicode characters, they are "surrogates" and can;t be "normalized": FAQ - UTF-8, UTF-16, UTF-32 & BOM[^]
20 Jan 2022 by M Imran Ansari
Try the following link: Python program to print the binary value of the numbers from 1 to N - GeeksforGeeks[^]
25 Feb 2023 by Pete O'Hanlon
How to use arrays to manage multiple items
26 Aug 2013 by Sergey Alexandrovich Kryukov
You can do it without using the said method, but other approaches (using selection properties) will be equivalent. Like it or not, the concept of selection is bound with the caret position, you cannot operate them independently.And this is how all text editors and word processors work these...
26 Aug 2013 by BillWoodruff
I don't see any conceptual barrier to your getting this done: here's a simple demonstration that requires a RichTextBox, and a Button on a Form.Wire-up the RichTextBox's SelectionChanged EventHandler as shown here, and the Button's Click EventHandler as shown here://keep track of the...
17 Sep 2014 by _Asif_
Your INSERT query syntax is wrong. The syntax isINSERT INTO [()] VALUES (Data1, Data2... DataN);Apart from that you need to use Parameterized SQL as explained by Sergey.
24 Nov 2014 by Afzaal Ahmad Zeeshan
Aren't those characters you're using in Delphi?In .NET you can use those two methods, to check the integer representation of the string. But, lets change them to characters, and you'll see that this same method works here too. // condition...if('1'
11 Mar 2015 by ZurdoDev
You never want to write code like this because your database can be damaged and/or hijacked by sql injection.Instead please use code similar to:sql = "UPDATE Lecture1 SET age = @age, Gender = @Gender..."cmd.Parameters.AddWithValue("@age",...
22 Mar 2015 by Josh H
I keep getting the error "SyntaxError: Unexpected token case". I don't know what I am doing wrong. I could not narrow the code down even though I tried. var user = prompt ("Are you a goblin, knight, troll, human, or wizard?").toLowerCase()var name = prompt("What is your...
15 Jun 2015 by CPallini
Quote:example: if i have array[4][4], is it possible to type array[16] instead of the usual way?Yes , it is possible.Quote:is it considered as a 2-d array?Nope, however you (that is your code) may consider it as a 2-d array, e.g. #define ROWS 4 #define COLS 4 int x[ROWS *...
15 Jun 2015 by OriginalGriff
Yes...but...it's not necessarily a good idea.In essence, all memory is just "chunks" of RAM, and the various structures we put in our code are ultimately "mapped" to those chunks.So whileint arr2p[4][4];andint arr1p[16];Will probably occupy the same amount of memory, the second is...
29 Jul 2015 by himanshu agarwal
This may give you some pointers.https://msdn.microsoft.com/en-us/library/ms973842.aspx[^]Read the section, "How to Move Java Applications to the .NET Framework".
1 Sep 2015 by Member 11950310
My Code is that but in dont know display that errorDim SampleOrder As String = Nothing Dim Requester As String = Nothing Dim ProjectNumber As String = Nothing Dim CostCenter As String = Nothing Dim PersonInvoiced As String = Nothing Dim SelectQuery...
20 Jan 2016 by Richard Deeming
Seems simple enough:private bool MyCommandCanExecute(object state){ return true;}private void MyCommandExecute(object state){ // Do something...}...ICommand myCommand = new Command(MyCommandExecute, MyCommandCanExecute);
11 May 2016 by Aescleal
You're using C++ - don't mess about with the C preprocessor. Don't use a global variable, hide the lot behind an interface and parameterise everything from above. It's a lot cleaner and a lot more extensible when a customer rolls up with another device you've got to support.
11 May 2016 by leon de boer
On your updated info then you likely have an unmatched #ifdef #endif in one of your included files. Find it that is what is causing the problem.The quick way is add an #endif to the bottom of each included file and the compiler should throw a tantrum about too many #endif's ... something...
30 Jun 2016 by cigwork
Look very carefully at the end of the data structure. Looks like you have a comma more than you need.The address strings also look a little odd. What's with the square brackets? Try changing them to, for example, "bld.no 234 N.C.H colony".I take it that friends isn't meant to be a JSON...
20 Dec 2016 by Dave Kreskowiak
You cannot put a space in a variable name. You have: @Report, @Flavors, @Name , @Phone No)";.. and. command.Parameters.AddWithValue("@Phone No", row.Cells[6].Value);Remove the space from "Phone No".
21 Aug 2018 by willifritz
Fruit must have a parameterless constructor. Add public Fruit() { } to your Fruit class and var AllFruits2 = Fruit.GetAll(); should work.
24 May 2019 by phil.o
You can try to replace each else if with elseif. This statement has no space between words in PHP.
11 Jul 2019 by Maciej Los
I have no idea what you mean by "standard C# LINQ functions"... If you would like to use Non-linq solution, you can loop through the collection of customers by using for or foreach statement: List nodes = new List(); foreach(Customer c in customers) { var node = new...
1 Aug 2019 by Richard Deeming
Simple: calculate the total difference in minutes, and use division and the modulus operator[^] to convert that to days, hours, and minutes. SELECT EstimatedShipDate, AppointmentShipDate, ActualShipDate, DateDiff(minute, IsNull(AppointmentShipDate, EstimatedShipDate),...
1 Aug 2019 by MadMyche
Richard's answer is correct; and for ad-hoc queries or in a report this would be the way to go The first thing you need to understand is that DateTime items are actually numbers, and that any math you are doing with them is a conversion to the number, perform the math on the number, and convert...
24 Apr 2020 by MadMyche
2 problems with your script. The big problem is that you stumbled on a 20 year vulnerability called SQL Injection; perhaps you have heard of it. NEVER EVER should you create an SQL command by combining commands and user entered text. What you...
23 Jun 2020 by MadMyche
As Patrice and 0x01AA have pointed out, you should watch for spaces and other separators. Your statement does not have a space between the parentheses VALUES, and then an empty value at the end of the statement INSERT... , Active)VALUES(... '" +...
23 Jun 2020 by Patrice T
SQL = "INSERT INTO Employee (Email, First_name, Last_name, Phone, Admin, Active)" SQL += "VALUES ('" + email + "','" + first_name + "','" + last_name + "','" + phone + "','" + admin + "','" + active + "');" Not necessary a solution to your...
4 Dec 2020 by Chris Copeland
My understanding from reading the documentation[^] on this is that static properties don't support the type being explicitly declared. I couldn't find any examples of it, so perhaps just remove the string type declaration?
19 Jan 2022 by CPallini
Quote: e = ['6']['12'] That's not valid Python syntax. Quote: yes i got a output like that the whole program is a = int(input()) b = int(input()) c = int(input()) for i in range(a, b+1): if i%c==0: d = str(i) e = d.split() print(e,end=" ") So it...
31 Jan 2022 by Richard Deeming
A collection initializer can work with multiple parameters - for example: private static Dictionary _dataStructure = new() { ["Foo"] = new MyDataPlot { { 0, 1 }, { 2, 3 }, { 4, 5 }, }, }; ...
17 Feb 2022 by Pete O'Hanlon
What is an array and how to use it to manage multiple items
26 Jul 2022 by Richard MacCutchan
You have got your indentations wrong, so the elif statements are not being recognised as connected to the previous if. It should be: elif o == "7": price=float(input("What was the original price of your purchase:")) if price
24 Jul 2023 by Richard Deeming
Dave is correct; if you add in the variable types, you can see the problem more easily: Dim entriesTasksQuery As IEnumerable(Of Task(Of IEnumerable(Of String))) = ... It's obvious that you can't pass the entriesTasksQuery variable to a...
19 Oct 2011 by Bernardo Castilho
I would like to know if there's a CodeProject article describing the syntax colorizer CodeProject uses, and whether that is available to others.I really like the way it works and would like to use it in my site.
19 Oct 2011 by theanil
http://www.carlosag.net/Tools/CodeColorizer/[^]
21 Oct 2011 by Elman90
Hi guys, i am using visual studio 2010 c#. This function is suposed to connect to a database and create a view for further use. Unfortunately when i run the program it says "Incorrect syntax near 'View' ". But the syntax is correct! I try running the string comand in SQL query and it works. But...
17 Nov 2011 by coffeenet
Hi,I am trying to gprof my program. I want a line-by-line profiling.However, I can't seem to get the syntax write. I am using "make" and not "gcc" so please help only with suggestions that fit make. I wouldbe very grateful if you can give me the full "make" syntax.Based on this...
18 Nov 2011 by Richard MacCutchan
The '-l' option is not valid for gcc so it assumes that it, and all following options, should be passed to the linker. You need to check which options are valid for gprof, as described here[^], and for gcc as described here[^].
9 Sep 2012 by Ali_100
This is an SP,when i execute in SMStudio it getting error Msg 102, Level 15, State 1, Line 7Incorrect syntax near ')'.DECLARE @tblPossibleAudits TABLE (auditid int)SELECT DISTINCT TBL.auditid, AD.auditnameFROM (SELECT POS.auditid, COUNT(AJ.loanmasterid) as totalloans,...
9 Sep 2012 by Prasad_Kulkarni
Try this:SELECT DISTINCT TBL.auditid , AD.auditnameFROM (SELECT POS.auditid , count(AJ.loanmasterid) AS totalloans , count(IMG.loanmasterid) AS imgloadedloans FROM @tblPossibleAudits POS INNER JOIN auditjunction AJ ON AJ.auditid = POS.auditid LEFT JOIN...
9 Sep 2012 by manognya kota
Hi,i guess there is an extra ) after IMG.Try removing that.
9 Sep 2012 by Afzal Shaikh
ON AJ.auditid = POS.auditid LEFT JOIN ldocumentimages IMG)remove ) from this line...Thanks,
6 Dec 2012 by Noe Prins
Hi, I am trying to implement the SVM given here.Support Vector Machine Classifier[^]I am not very familiar with C++. I have 2 issues.1.There is a bunch of errors when I just add the two *.h and *.cpp files to my library, even before I use any of the code. Why is that?2.Is there a...
6 Jul 2013 by Firdaus Shaikh
I want to Convert number to their Devanagari equivalent in crystal report,Below is the code I'm using in Crystal Report Formula FieldLocal StringVar Source;Source ="12345";Local StringVar Array Find[9] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];Local StringVar Array...
10 Oct 2013 by adat7378
Hi, I am trying to achieve multiple partial word search on a single field. My search syntax looks like below.Dim terms = searchstring.Trim().Split(" "c).Where(Function(x) Not String.IsNullOrEmpty(x)).[Select](Function(x) x.Trim() + "* &&") searchstring = String.Join(" ", terms) ...
11 Oct 2013 by ASP.NET Community
IntroductionLINQ is one of the new entrants in C# 3.0, introduced as part of .NET 3.5. As you are already aware, LINQ is a unified querying
11 Oct 2013 by ASP.NET Community
DLR Expression is the backbone of the DLR. It is a separate feature that you can use without involving the rest of the DLR.Let’s take a look at
16 Mar 2014 by FarhanShariff
Can any one tell me what the syntax error is in the code below here i am trying to find minimum of two values cpK.Expression = "IIF((Convert(point50,'System.Double') - Convert(LSL,'System.Double'))
17 Mar 2014 by Bernhard Hiller
/3.0/Sigmais at the wrong position. You must apply it to both possible choices:cpK.Expression = "IIF((Convert(point50,'System.Double') - Convert(LSL,'System.Double'))
15 May 2014 by LuOPa
HiI'm building a templating engine based upon the razor engingeIs there a way to get the syntax higlighting for your custom razor template e.g. for your .cstxt file?It would be totally enough just to get the razor parts highlithed whitin visual studio.Any ideas how to achieve...
28 Aug 2014 by cobusbo
Hi can anybody assist with this syntax error please. I'm trying to replace bad words with ":-x" when it is being retrieved from the database...$bwords = aray("admin", "mod");$pmsg = if($list['StringyChat_message'] = $bwords) {echo ":-x";} else { echo "$list['StringyChat_message']";}
28 Aug 2014 by ChauhanAjay
Try changing the line from $pmsg = if($list['StringyChat_message'] = $bwords) {echo ":-x";} else { echo "$list['StringyChat_message']";}To $pmsg = ($list['StringyChat_message'] == $bwords) ? ":-x" : $list['StringyChat_message'];
28 Aug 2014 by ChauhanAjay
Try thisecho "(". date( 'D H:i:s', $list['StringyChat_time'] ) .") ". $list['StringyChat_name'] ." : ".$list['StringyChat_message'] . "";
30 Aug 2014 by Mehdi Gholam
Consult MSDN resources, start here :...
16 Sep 2014 by Kan07
cmd.CommandText = "INSERT INTO SSS_Contribution VALUES (" + txtEmployeeID.Text + " ,'" + txtEmployeeLastName.Text + "','" + txtEmployeeFirstName.Text + "','" + txtEmployeeMiddleName.Text + "', '" + txtSSSNo.Text + "', '" + txtClient.Text + "','" + txtCoordinator.Text + "', '0.00', '0.00', ...
16 Sep 2014 by Kim Togo
As Sergey has written. Do not concat SQL statements in a string and use user input directly.A simple description that is easy to understand can be found here: Give me parameterized SQL, or give me death/[^]A simple user input in "txtEmployeeLastName.Text" like => Hello 'Worldwill make...
25 Oct 2014 by /\jmot
My code was like this..But there was a problem..The Controls collection cannot be modified because the control contains code blocks so, i had to chnage it..i got some solution telling to use [
26 Oct 2014 by jkirkerx
Watch this video on user controlshttps://www.youtube.com/watch?v=iLDx8G8Qgb0[^]What your doing in your example is old school, sort of asp classic or php like.In asp.net, you can create a server control in code behind of html elements, or a user control, and just register the control...
24 Nov 2014 by sina1
simple querstion:string a="1" (string)string b="2" (string)I want to know which is bigger؟Without use(Convert or int.tryParse) in c#??--------------------------------------Delphi seven it was possible in delphi:if('1'
11 Mar 2015 by Member 11516719
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click connect.ConnectionString = "Provider=Microsoft.jet.OLEDB.4.0; data source = |datadirectory|/Lecture1.mdb" connect.Open() Dim cmd As OleDb.OleDbCommand = New...
22 Mar 2015 by George Jonsson
Looks like you are a bit stingy with the semicolons.Try ending each statement with ;var user = prompt ("Are you a goblin, knight, troll, human, or wizard?").toLowerCase();var name = prompt("What is your name?").toLowerCase();var gender = prompt("Are you male or...
22 Mar 2015 by Peter Leow
Quite a number of typo, for example = instead of ==, ; instead of ) etc, got it fixed:var user = prompt ("Are you a goblin, knight, troll, human, or wizard?").toLowerCase()var name = prompt("What is your name?").toLowerCase()var gender = prompt("Are you male or...
23 Mar 2015 by Santosh K. Tripathi
Hi,I found these ; & ) & } are missing or extra at various places. I made required correction, because i found you are a beginner in javascript (may be in programming also). When i started programming few years back i also do same mistakes.For a beginner if code runs "I got victory on...
30 Mar 2015 by OriginalGriff
You have to use HTML encoding: it changestextIntotextWhich is automaticaly converted back into the readable form by the browser.Exactly how you do that will depend on what you are writing your website in! :laugh:But Google should be able to help: just try "HTML Encode...
30 Mar 2015 by Afzaal Ahmad Zeeshan
In addition to OriginalGriff's answer about encoding, have a look at the pre element[^] in HTML, which allows you to write code as it is. So, for example (like this example on CodeProject), you can write this This is a paragraph.It will be rendered as, This is a...
8 Jun 2015 by MOUTAZ877
'Updating AdjustmentHead & AdjustmentDetails'------------------------------------------- 'update AdjustmentHead strSql = "UPDATE AdjustmentHead SET AdjustmentHead.[Adjustment+V] = " & Forms![AdjustmentHead]![Adjustment+V] & ", AdjustmentHead.[Adjustment-V] = " &...
8 Jun 2015 by ZurdoDev
It looks like you might need quotes around some of your values, however, do not try to fix the code you have. Please change the code you have to use parameters so that you are doing it correctly.For example:String sql = "UPDATE table1 SET field1=@field1,...
15 Jun 2015 by Iris91
hi,is it possible to write 2-d array in a different syntax other than array[i][j]? example: if i have array[4][4], is it possible to type array[16] instead of the usual way? is it considered as a 2-d array?
1 Oct 2015 by Member 12025162
Hello, I am a very new beginner of Python GUI. I wrote a very simple script but I am not sure what is wrong with it. Help please.Score = 0_question_No = 0while _question_No != 10: num1 = (random.randint (0-10)) num2 = (random.randint (0-10)) num3 = (random.randint...
1 Oct 2015 by Richard MacCutchan
Quite a lot is wrong. You are mis-spelling variables (upper/lower case first letters) so they do not match. And all the code below the first few lines are not correctly indented. The correct version is as follows:import randomscore = 0_question_No = 0while _question_No != 10: num1...
5 Nov 2015 by ChauhanAjay
HelloKindly go through the link below http://stackoverflow.com/questions/4668557/parse-error-syntax-error-unexpected-t-static[^]Hope it helps
19 Jan 2016 by Patrick Skelton
Hi,I am trying to get my head around ICommand. I've done a lot of reading. Almost all of it shows the mechanics of the Command being specified using lambda syntax. I can see the value of that, but, simply to deepen my understanding, I would like to know how to write the code long-hand,...
4 Mar 2016 by Scribling Doodle
Hello,Since i'm not that good with MySql Syntaxes, i'm here asking for a syntax that could insert values and update 2 tables.Scenario:I have a table called "Entradas" and one called "Saidas". Both have the column "data" and "hora". With that in mind, since the "data" and "hora...
19 Mar 2016 by Emba May Wimbush
i'm keep getting syntax errors with this code for a game (Boolean True = True // True = X (turn)False = Y (turn)) Int(turn_count() = 0) new to codingneed helpWhat I have tried:Adding and taking away many brackets, spaces etc
19 Mar 2016 by Dave Kreskowiak
I'm assuming that code is supposed to be VB.NET, only because of the error number. That number isn't even a valid Basic Compiler error, but since it starts with BC, I'm assuming this is supposed to be VB.NET code.You're code doesn't make any sense at all. There isn't even enough there that...
23 Mar 2016 by GaneshRfromSpace
I need to clock all port pins in my MKE02Z64VLD2 Controller. What is the Syntax to clock all port pins in a freescale's KE-02Z series controller ?What I have tried:SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | ...
10 Apr 2016 by OriginalGriff
It's the space in your name.Try this:DV.RowFilter = String.Format("[User name] Like '%{0}%'", TextBox6.Text)BTW: Do yourself a favour, and stop using Visual Studio default names for everything - you may remember that "TextBox6" is the user name today, but when you have to modify it in...
20 Apr 2016 by Member 12473898
I this error:"Syntax error in UPDATE statement."My code is: Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click con.Open() Dim q As String = "UPDATE Table1 SET " & "FirstName='" & Me.txtFName.Text & ...
10 May 2016 by leon de boer
Pwasser is correct to just comment the whole lot of conditionals out and use the second option directly#include HTU21D weather;Does it compile like that and if it won't it's nothing to do with conditionals, it will be things like there is stuff in BMP180 that you need also in HTU21D.
14 May 2016 by PJ Arends
Try using #elifs instead of #endif/#ifs#if SENSOR_TYPE == SENSOR_BMP180// stuff#elif SENSOR_TYPE == SENSOR_HTU21D// stuff#elif SENSOR_TYPE == SENSOR_DS18B20//stuff#elif SENSOR_TYPE == SENSOR_NONE//stuff#else// Unknown SENSOR_TYPE#endif
20 Dec 2016 by Patrice T
Try to replace:VALUES(@Column1, @Column2, @Column3, @Date, @ReceiptNo, @DeliveryPerson, @Report, @Flavours, @Name , @Phone No)withVALUES(@Column1, @Column2, @Column3, @Date, @ReceiptNo, @DeliveryPerson, @Report, @Flavours, @Name , \"@Phone No\")
12 Apr 2017 by Richard MacCutchan
Quote: they won't even compile. Then that should give you a clue. I don't think there is anything to be gained from over complicating a constructor. See lambda expressions - Google Search[^].
13 Apr 2017 by Muhammd Aamir
HI everyone i am new to mvc i am facing a problem, i have a simple view that contains a form and a foreach loop the syntax of the loop goes fine if i did this @model IEnumerable but the syntax of labelfor give me error and if i did this @model...
13 Apr 2017 by NightWizzard
The declaration @model IEnumerable tells the view, that the provided data is a kind of collection of type Students - this can be used in a loop. The declaration @model SearchBox.Models.Students tells the view that there is only a single object of type students...
13 Apr 2017 by Karthik_Mahalingam
Quote: but how i can use both in my view. it shall be done in this way if you need to show from only one model @Html.LabelFor(model => model.First().Name, "Name", htmlAttributes: new { @class = "control-label col-md-2" })
8 May 2017 by Rick York
Another way to look at the asterisk is as the pointer dereference operator. It obtains the value of where pointer is aimed which for an array is the first item of the array. In printf, %s refers to a string, an array of characters so the address of the array needs to be passed. The %c format...
8 May 2017 by CPallini
Because they are really different beasts. I would suggest you reading a tutorial on the topic, like, for instance: Everything you need to know about pointers in C[^].