16,004,727 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Atlapure Ambrish (Top 76 by date)
Atlapure Ambrish
18-Oct-18 4:47am
View
If i have not overlooked the code, he is using dataset in db.cs - GetLocationHistory() method and ExecuteNonQuery is used for other save methods.
Atlapure Ambrish
18-Oct-18 4:26am
View
one alternate could be to loop over the datareader and covert the result to a collection of some class and then return to the controller.
Atlapure Ambrish
18-Oct-18 4:01am
View
and what about the api get method? are you seeing the data in dataset which you are returning from the method??
On another note, web api should always return a standard format data e.g. JSON, XML. so that it is not restricted to specific applications. So, I would return JSON from GetLocationHistory and GetUser methods.
Atlapure Ambrish
18-Oct-18 4:01am
View
Deleted
and what about the api get method? are you seeing the data in dataset which you are returning from the method??
On another note, web api should always return a standard format data e.g. JSON, XML. so that it is not restricted to specific applications. So, I would return JSON from GetLocationHistory and GetUser methods.
Atlapure Ambrish
18-Oct-18 3:44am
View
I would suggest you to capture the stored procedure call in 'SQL profiler' and try to run the same from SQL management studio to check if it is returning intended result.
Atlapure Ambrish
18-Oct-18 3:31am
View
What error you are seeing?
Atlapure Ambrish
18-Oct-18 3:04am
View
where is your loop??
Also, you are assigning 0 to value, instead it should be assigned to numbers item in loop and then parse.
Atlapure Ambrish
17-Oct-18 9:13am
View
The new property you add to partial class should be available automatically, because the new partial class is nothing but your entity :).
Atlapure Ambrish
31-Oct-17 6:54am
View
Not clear, maybe you want to use 'Improve question link to add more details on what you are looking for. With your explanation above, can't you just use where clause with IN and mention the index values you want to select data for?
Atlapure Ambrish
31-Oct-17 3:42am
View
This should work, I have checked it and is working for me. What is the datatype of date_time column?
Atlapure Ambrish
26-Oct-17 10:52am
View
no problem, it's my pleasure!
Atlapure Ambrish
25-Oct-17 3:33am
View
I am sure you have referred these articles, but still wanted to point those out..
http://gsferreira.com/archive/2015/02/how-to-encrypt-in-nodejs-and-decrypt-in-c-sharp/
https://social.msdn.microsoft.com/Forums/en-US/47800a60-4461-4f8e-a8d1-751fa62c7884/aes-encrypt-in-javascript-and-decrypt-in-c?forum=csharpgeneral
Atlapure Ambrish
25-Oct-17 3:10am
View
I hope your problem is resolved..
Atlapure Ambrish
13-Oct-17 2:26am
View
yes correct, if you are deploying your application on other machine and keeping database on your machine, then you have use shared path for database on other machine.
Atlapure Ambrish
12-Oct-17 7:39am
View
I am not sure, What you are trying to do in the trigger on Table2.
Also, if you write a trigger on Table1, you don't need to loop through the rows, you have t1_id (FK) in table2, so, you will be able to easily delete all the rows using this FK after you get ID in the trigger from deleted table.
DELETE FROM TABLE2
WHERE t1_ID = ID
Atlapure Ambrish
12-Oct-17 5:56am
View
If it is the machine your working on then you don't need the shared path, you should just use normal path e.g.: c:\abc.mdb
Atlapure Ambrish
12-Oct-17 2:46am
View
Deleted
can you try to open the .mdb file using access and save it as .accdb and try to connect?
Atlapure Ambrish
12-Oct-17 2:45am
View
Can you try opening the mdb file in access and save as .accdb and try to connect?
Atlapure Ambrish
12-Oct-17 2:01am
View
The connection string is absolutely fine (just check if you are able to access the network path), what problem are you facing now?
Atlapure Ambrish
11-Oct-17 13:43pm
View
For every month and day there is different code? As you mentioned X is Oct and B is day 11, these will change for other month and day??
Atlapure Ambrish
11-Oct-17 13:34pm
View
Oops its my bad.. Thanks for making me realize.. I somehow overlooked it.
Atlapure Ambrish
11-Oct-17 7:16am
View
Where you have mentioned this in your original query? before down voting you should share such details. isn't it??
Atlapure Ambrish
11-Oct-17 5:20am
View
you can still use "case" statement.
below is an example..
CREATE TABLE OrderDetail
( OrderID INT
, ProductID INT
, Qty INT
, OrderDate DATETIME
, ShipDate DATETIME
, STATUS AS CASE
WHEN shipdate is NULL AND orderdate < DATEADD( dd, -7, GETDATE()) THEN 'Late'
WHEN shipdate is NOT NULL THEN 'Shipped'
ELSE 'Ordered'
end
)
insert into OrderDetail
values(1, 12, 123, '10/05/2017', NULL)
Atlapure Ambrish
11-Oct-17 4:22am
View
What was the problem with solution I had provided?
Atlapure Ambrish
11-Oct-17 3:09am
View
what do you mean by link? have you added any hyperlink in your code? I don't see any. Please provide more details.
Atlapure Ambrish
11-Oct-17 2:51am
View
The way date.subtract is designed, it is giving you correct result, but it seems you want to include the starting day as well. In this case you just need to add 1 to the result returned by date.Subtract method.
Atlapure Ambrish
11-Oct-17 2:43am
View
no problem, use username instead of role in the if statement as I have already mentioned in my solution.
Atlapure Ambrish
11-Oct-17 2:39am
View
c$ is the drive name on the machine where the database is kept
Atlapure Ambrish
10-Oct-17 23:08pm
View
How you are binding data to your list boxes?
What problem/error you are getting while removing the item from list?
Atlapure Ambrish
7-Oct-17 0:49am
View
I think SelectVoiceByHints is throwing that error. Cant you debug and see which line is throwing the exception??
Atlapure Ambrish
6-Oct-17 13:55pm
View
Can you remove sum(0.000) from both queries and check if it is not throwing that error after tweaking the query as required.
Atlapure Ambrish
5-Oct-17 10:15am
View
Add more details on what you are trying to achieve..
Atlapure Ambrish
3-Oct-17 12:49pm
View
Please ask specific question. From your explanation it is not clear what you want to achieve. If you have json you can convert it to a complex type i.e. Class using a standard library and use specific properties of the class to insert in different tables.
Atlapure Ambrish
3-Oct-17 10:52am
View
Yep, definitely, I don't see any reason for this to not to work.
Atlapure Ambrish
3-Oct-17 10:45am
View
The ideal approach for such scenario should be:
Use SqlCommand.ExecuteScalar() and cast it to an int, something like below:
cmd.CommandText = "SELECT COUNT(*) FROM table_name";
Int32 count = (Int32) cmd.ExecuteScalar();
you may use Convert.Int32 for casting.
Atlapure Ambrish
3-Oct-17 10:25am
View
Thanks
Atlapure Ambrish
3-Oct-17 3:49am
View
Can elaborate more on what exactly your are trying to do??
Atlapure Ambrish
3-Oct-17 3:04am
View
Have you tried this https://stackoverflow.com/questions/3594143/dynamically-set-hyperlink-controls-navigateurl-property-inline
Atlapure Ambrish
18-Aug-17 10:23am
View
I have used frm1 and frm3 in example, so, the code in frm1 should go to form1.cs and frm3 should go to form2.cs if you have classes. Otherwise refer it as example, it shows how you can access it another form.
Atlapure Ambrish
18-Aug-17 10:19am
View
My brother, I would leave defensive coding part to the author :)
Atlapure Ambrish
18-Aug-17 10:18am
View
Ideally, the databases are designed that way.. :)
Atlapure Ambrish
3-Aug-17 6:07am
View
I do not see your code like the one below. The con.Dispose will close the connection and release associated resources.
Dim con As New SqlClientConnection( . . .)
Try
' DB Operations (create, read, update, delete) here
con.open()
Catch SqlClientException (ex)
' Deal with exception
Finally
' Code here will always run, whether or not the try code succeeded
' or if you wound up in a catch block. You can safely call .close()
' or (as shown below) .dispose() because if the connection is already
' closed/disposed, the call doesn't do anything.
' Dispose is what you want - it will not only close the
' connection, but it will release the .NET reference to
' the remote resource, freeing up that resource (the database
' in this case) to serve other clients.
con.Dispose()
End Try
Atlapure Ambrish
26-Jul-17 3:35am
View
Can you elaborate more on the error and on which line you are getting it? It is not clear from your description.
Atlapure Ambrish
25-Jul-17 3:51am
View
Sure, accept the solution once you try and it works for you, so that it will be helpful to others as well.
Atlapure Ambrish
25-Jul-17 2:49am
View
Have looked at this? it might be helpful to you.. https://stackoverflow.com/questions/9219557/creating-text-file-without-using-bcp-in-sql
Atlapure Ambrish
24-Jul-17 9:16am
View
Please accept the solution :)
Atlapure Ambrish
24-Jul-17 9:15am
View
have you tried this.
DateTime dateValue;
DateTime.TryParse("5/01/2008", out dateValue)
int a = Sadapter.Insert(txtSErNo.Text, txtSfname.Text, txtSLname.Text, txtSadd.Text, txtScity.Text,txtSstate.Text,
txtSpin.Text, dateValue,
DrpGender.SelectedItem.ToString(), txtSMoNo.Text, txtSeid.Text, txtSUname.Text, txtSpass.Text);
Atlapure Ambrish
24-Jul-17 8:59am
View
Got it, I think you are trying to use the TryParse in Insert method, instead do it before insert and then use dateValue variable in Insert method. like this..
DateTime dateValue;
DateTime.TryParse("5/01/2008", out dateValue)
Sadapter.Insert(txtSErNo.Text, txtSfname.Text, txtSLname.Text, txtSadd.Text, txtScity.Text,txtSstate.Text,
txtSpin.Text, dateValue,
DrpGender.SelectedItem.ToString(), txtSMoNo.Text, txtSeid.Text, txtSUname.Text, txtSpass.Text);
Atlapure Ambrish
24-Jul-17 8:54am
View
I am not understanding.. can you elaborate more. It would be helpful to see your code with TryParse you are trying.
Atlapure Ambrish
24-Jul-17 8:32am
View
Convert the values selected in dropdown lists to date format string first and then use it in TryParse e.g.:
DateTime dateValue;
DateTime.TryParse("5/01/2008", out dateValue)
please refer the article I have provided in my solution.
Atlapure Ambrish
24-Jul-17 7:38am
View
Have you tried this.. the MSDN says...
https://msdn.microsoft.com/en-us/library/bb629303.aspx
Atlapure Ambrish
24-Jul-17 7:33am
View
Can you show me the code what exactly you tried?
Atlapure Ambrish
24-Jul-17 6:07am
View
The LEFT join is made for that. In Thomas' solution he has already suggested to use LEFT join, this should solve your problem. What is the issue?
Atlapure Ambrish
24-Jul-17 3:13am
View
Yeah, its not a problem but definitely a improvement!
Atlapure Ambrish
24-Jul-17 2:06am
View
Another problem I see in the code is use of unnecessary variable "decimal TotalSum = sum;", instead of defining a new variable, you can use 'sum' variable.
Atlapure Ambrish
24-Jul-17 1:45am
View
Try an online tool like this one to tweak your XSL quickly and see the result immediately. http://www.utilities-online.info/xsltransformation/#.WXWBh4SGPcs
Atlapure Ambrish
24-Jul-17 0:44am
View
It is up to your requirements, but it is possible to have 100 fields in one table. In fact if you use multiple tables say e.g. 4 tables with 25 columns each with foreign key reference, while fetching data from all these 4 tables will be a performance hit (as you would use joins). If you use single table you can simply fetch all the data at once and use it based with your logical grouping in front-end.
Atlapure Ambrish
24-Jul-17 0:26am
View
No problem, I am glad that it was helpful to you!
Atlapure Ambrish
22-Jul-17 8:07am
View
Can you try CTRL+ALT+E?
for more details refer https://blogs.msdn.microsoft.com/zainnab/2010/12/01/the-exceptions-dialog/
Atlapure Ambrish
22-Jul-17 7:29am
View
Here's an article it is not for asp.net but explains the steps..
http://blog.scottlogic.com/2015/03/09/OAUTH2-Authentication-with-ADFS-3.0.html
Atlapure Ambrish
21-Jul-17 7:30am
View
Keeping the whole datatable in viewstate is going to be very heavy and has to sent along the request/response. Also, you would like to pay attention to cast.
Atlapure Ambrish
21-Jul-17 7:27am
View
You can use two different datatables. One to work with dynamic grid, which will be created every time and bound to this grid so it does not show any data. When you hit Add/Insert button just copy the data from this datatable to the datatable which is bound to other other grid using built-in method.
Atlapure Ambrish
19-Jul-17 23:32pm
View
d.value in above query is your date column in datatable you are using.
Atlapure Ambrish
19-Jul-17 22:42pm
View
Its my pleasure!
Atlapure Ambrish
19-Jul-17 7:28am
View
The question was to move focus to another control on pressing enter key and this is the easy and quick solution.
Atlapure Ambrish
18-Jul-17 9:20am
View
That needs to be checked :), may be you can try it out after applying this solution for any one functionality?
Atlapure Ambrish
17-Jul-17 22:46pm
View
Can you try this? I have not verified it, but it seems this is similar to your problem statement. https://forums.asp.net/t/1605429.aspx?SQL+Join+Tables+on+Column+Name+and+Row+Field+Value
Atlapure Ambrish
17-Jul-17 13:53pm
View
And what is the issue??
Atlapure Ambrish
17-Jul-17 7:12am
View
Have checked if the folder/file is read-only on server? if it is, just remove the read-only flag from folder/file properties and see if it works.
Atlapure Ambrish
17-Jul-17 6:45am
View
You welcome!
Please don't down vote the answer, if you don't understand do ask questions.
Atlapure Ambrish
17-Jul-17 6:38am
View
If File.Exists("C:\j\WindowsApplication1.exe")
{
My.Computer.FileSystem.RenameFile("C:\j\WindowsApplication1.exe",
String.Format("{0}.exe", Path.GetRandomFileName().Replace(".", String.Empty)))
}
Atlapure Ambrish
15-Jul-17 11:21am
View
Also make your code defensive by using TryParse instead of Parse, with TryParse you would be making sure the textbox value is a number (also you would not get exception), if it is not then handle it properly and show required message to end user.
Atlapure Ambrish
15-Jul-17 10:53am
View
As you are already storing accessibility information in database, I am not sure why you need to store it in web.config again. I think you can simply get the role and accessibility information for logged in user and check for authorization.
For example, if you are using asp login control then, do something like this..
<asp:Login ID = "Login1" runat = "server" OnAuthenticate= "ValidateUser">
ValidateUser method is going to fetch data from DB and then you can handle the authorization.
Atlapure Ambrish
15-Jul-17 9:25am
View
Just read the value of controls/fields and append while preparing URL. For example on client side, find the control and fetch its 'value' and append. Same applies for server side code as well. In my example in the solution, you just need to replace actual values for place holders {TableIdValue} and {TableSeatIdValue}.
Atlapure Ambrish
14-Jul-17 3:35am
View
Are you using onload event to open the popup?
Atlapure Ambrish
10-Jul-17 7:45am
View
For CSRF refer below URLs..
https://software-security.sans.org/developer-how-to/developer-guide-csrf
https://stackoverflow.com/questions/29939566/preventing-cross-site-request-forgery-csrf-attacks-in-asp-net-web-forms
As you are thinking to generate a token and store it on server to validate later on, I think you can do that. The approach should be generate a GUID (or this could be any value of you choice, would be more beneficial if you could make it configurable) and then encrypt it before storing on server using some algorithm and then add this to a hidden field on your form. Encrypting would add an extra validation level.
Show More