|
Did you say that start_date has two digit year because of the data type which is
DateTime2(0). ?
If so, I can remove the 2 so we get 4 digit year.
Thanks for your help sir.
|
|
|
|
|
No, I said that start date has a two-digit year because that's what you showed: 14-05-05 10:34:03 .
(datetime2(0) is the correct SQL type to use; the "2" has nothing to do with the number of digits in the year.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's not what I showed sir.
I showed four digit year:
start date: 2014-05-05 10:34:03
end date: 2014-05-05 10:35:52
The year from my example is 2014
|
|
|
|
|
No it's not:
For instance, I queried with this range:
14-05-05 10:34:03 for start date and
2014-05-30 12:16:21 for end date
That start date only has a two-digit year.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If you're actually using four-digit years and you're still getting 700,000 records, then either you have 700,000 records in that date range, or DateTime.TryParse can't understand your input.
Try TryParseExact[^] instead:
Dim startDate As DateTime
If DateTime.TryParseExact(date_start.Text, "yyyy-MM-dd HH:mm:ss", Nothing, System.Globalization.DateTimeStyles.None, startDate) Then
cmd.Parameters.AddWithValue("@start", startDate)
Else
cmd.Parameters.AddWithValue("@start", DBNull.Value)
End If
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have actually switched to DateTime.TryParse using this:
m startDate As DateTime
Dim EndDate As DateTime
If DateTime.TryParseExact(date_start.Text, "yyyy-MM-dd hh:mm:ss", New CultureInfo("en-US"), DateTimeStyles.None, startDate) Then
cmd.Parameters.AddWithValue("@start", startDate)
Else
cmd.Parameters.AddWithValue("@start", DBNull.Value)
End If
If DateTime.TryParseExact(date_end.Text, "yyyy-MM-dd hh:mm:ss", New CultureInfo("en-US"), DateTimeStyles.None, EndDate) Then
cmd.Parameters.AddWithValue("@Endd", EndDate)
Else
cmd.Parameters.AddWithValue("@Endd", DBNull.Value)
End If
I am going to your solution instead.
You might be right about having that many records in the DB but this is the part that confuses me.
I run this in SSMS:
select startttime, endtime from cti.qpcdr where startttime >= '2014-05-05 10:34:03' and endtime <= '2014-05-05 10:35:52'
It returns one record.
I enter one value to start date and the other value to end date textboxes and it returns No record found.
If a record had been returned, it would have given me the confidence I need to conclude that it works.
|
|
|
|
|
You need to match the query in SSMS to the query you're using in your code. You're missing a join to at least one other table, and the cl.phone_number IS NOT NULL condition, both of which could filter out the one record you're seeing in SSMS.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Run Sql profiler and look at the t-sql that is being sent to the sql server. You should then be able to find the issue quickly.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
hi,
I need to open a word file which saved in server in client side(without open/save dialog and not download in client system) and let users to edit it. then save back this file in server again.
I try
Word.ApplicationClass for this, but it open word file in server side.
do you know any component or code in asp.net for doing this??
please answer and help me asap.
best regards.
|
|
|
|
|
You cannot open applications on the client side, especially if the client does not have it installed.
|
|
|
|
|
if office was installed in client system, Can I do this??
|
|
|
|
|
No, you cannot take control of a user's system from a browser; it is a security issue.
|
|
|
|
|
I'm using .Net core and when I first read of user secrets I thought it was brilliant. That is until I met the powershell command:
dotnet user-secrets list
I'm looking at storing them on the database again, and encrypting them using something like bcrypt to encrypt them. The weakness of this argument is that the key is in the code...
Thoughts anyone on secrecy?
Ger
|
|
|
|
|
Who are you trying to keep the secrets secret from?
dotnet user-secrets list will only list the secrets stored for the current user. And it's intended to keep them out of your source control, not to prevent you from seeing them.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm trying to keep them secret from the next person to use the machine. I missed the detail about that list command only applying to the current user. I am much relived.
Ger
|
|
|
|
|
First thing to mention here is, why are you even trying to store the secrets—I am assuming, connection strings, API keys, etc. etc.—in your own machine, unless your web server runs in the same machine. In testing or development environment, you should consider using testing or development credentials, that when exposed can be cleared, rotated and wiped without any panic.
I am not sure why you didn't read the documentation for this tool, Microsoft had already made it pretty much clear that this tool is not for "securely storing your credentials", rather "storing your secure credentials". There is a huge difference,
The Secret Manager tool doesn't encrypt the stored secrets and shouldn't be treated as a trusted store. It's for development purposes only. The keys and values are stored in a JSON configuration file in the user profile directory. So, that was pretty much clear from the documentation that this tool doesn't do anything on its own side and as Richard said, it merely takes the secure information out of your code, to prevent it from being version controlled.
If you are using an external hosting service, use their secure vaults (or something similar in technical terms). For example, it is a bad idea of store the security details or credentials in environment variables, or even in the databases that you hold or own. Because as you said,
Quote: I'm looking at storing them on the database again, and encrypting them using something like bcrypt to encrypt them. They are merely encrypted, anyone who has access to your machine—since this data is in your machine—has access to that database, which is clearly visible as these values are needed by your apps to function. Thus, anyone can access the keys.
The good practice to use nowadays is to use secure vaults, you can check with your hosting providers to check if they do provide any. For example, on Microsoft Azure you should use Azure KeyVault, Key Vault | Microsoft Azure, which secures your credentials and resists tampering against it.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: I am not sure why you didn't read the documentation for this tool, Microsoft had already made it pretty much clear that this tool is not for "securely storing your credentials", rather "storing your secure credentials". There is a huge difference,
Chances are I missed it when reading it, although I'm not sure whoose documentation I read on the subject so it might not even have been mentioned. Either way it was lost on me.
Afzaal Ahmad Zeeshan wrote: They are merely encrypted, anyone who has access to your machine—since this data is in your machine—has access to that database,
This is why I move away from database storage in the first place.
Afzaal Ahmad Zeeshan wrote: For example, on Microsoft Azure you should use Azure KeyVault
And this is the real value in your response.
Ger
|
|
|
|
|
Hi,
I built an ASP.NET web API but unfortunately, it is legacy. So I want to refactor it by using a generic repository, DI, etc. Are there any useful tutorials that I can use?
Best Regards.
|
|
|
|
|
Cenk KIZILDAĞ wrote: Are there any useful tutorials that I can use? There are, even on this site.
Cenk KIZILDAĞ wrote: So I want to refactor it by using a generic repository, DI, etc. Start with identifying where DI would be appropriate, and asking yourself what you gain from it. Don't add something just to say you added it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: There are, even on this site
Can you please share one or two? I read couple of them but still have questions in my mind.
|
|
|
|
|
|
|
Quote: it is legacy. One tip that I would like to give is, that you should consider using ASP.NET Core instead of ASP.NET, as ASP.NET Core introduces cross-platform deployment support, is lightweight and can be extended to support any runtime.
Quote: So I want to refactor it by using a generic repository, DI, etc. Everything that you mention here is a part of ASP.NET Core, and you can easily integrate these in your own applications without having to change or break the design pattern of ASP.NET Core development, and design.
Quote: Are there any useful tutorials that I can use? Sure, start here, Create web APIs with ASP.NET Core | Microsoft Docs.
What you can explore there includes the DI, repositories for your data stores, and other best practices like asynchronous controllers and middlewares for ASP.NET Web API.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I have a razor pages application built in 2 projects, database access and the ASP.net application with data services, controllers and pages.
I now want to access the ASP.net data services part of the application from a mobile project. Does the ASP.net application need to be split into a web API and a client project or can I use the ASP.net project as a web API data service?
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|