|
SQLite isn't open to SQL Injection, because it doesn't support multiple commands in the same command*: it doesn't support bulk inserts, even via a DataAdapter. it is meant to be a "lite" version, after all!
So if you build your command with multiple VALUE fields, it is technically safe (but needs to be commented in case someone later converts to MSSql / MySql)
I'd recommend using a transaction though, just to speed the operation up if nothing else...
This may help: https://stackoverflow.com/questions/1711631/improve-insert-per-second-performance-of-sqlite[^]
* Unless you use the CommandText property instead of a SqlLiteCommand - then you are wide open to SQL Injection.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: * Unless you use the CommandText property instead of a SqlLiteCommand - then you are wide open to SQL Injection. Uh oh, that's what I'm using. I'm setting the CommandText property of a SQLiteCommand to the long INSERT statement.
I wasn't aware that there's any different way. Is there?
EDIT: I misread your post. What is the other way of using the CommandText property instead of a SQLiteCommand? (Just curious)
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
No, the CommandText is a property of the SqLiteCommand object: SqliteCommand.CommandText Property (Microsoft.Data.Sqlite) | Microsoft Learn[^]
SqLite is just that: a "lite" version of SQL - it isn't meant for big jobs.
I'd be tempted to say that you might be better off using SQL Server if you are working with large databases - but that's your decision and I don't know enough about your system(s) to reccomend it.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Anyway, I appreciate you pointing out that it's not susceptible to injection attacks. That was the reason for my question.
Thanks!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Did you actually time the separate inserts? "Thousands" isn't very much and the server is "local". The usual consideration is don't do "mass inserts" with an index ... drop and build the index afterwards.
I've experience seconds, but never "hours".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I might have used hyperbole, but the database will contain upwards of 4 million rows.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Using Marc Jacobi's VST.NET2, I'm able to get the effect name and vendor for a VST2 DLL file, but an error is thrown, if I try it on a VST3 file. There must be an easy way to do this. I had read somewhere that VST3 files are basically just DLLs, but it appears there's a diff for what i'm trying to do. I've been searching and testing for days. Not a whole lot of C# examples. Seems C++ is used nearly exclusively.
|
|
|
|
|
Why not ask in the forums on his articles.
|
|
|
|
|
|
Hi,
I want to become a freelancer programmer able to take jobs posted
on freelancing sites or be part of a team where I can do at the begining small tasks for gaining experience.
For that I have started to learn C++ and then WINAPI and when I was asking here questions about my WINAPI isues the experienced guys here told me that I am learnig an old tool and a very nice member here that helped me a lot recommended me .NET field with the book of Charles Petzold - .NET book zero, that was an excelent book because it dosen't entered in details.
Now I have finished this book to, what tool you recommend me to learn next, what steps should I take
that help me gaining experience and to be able to start working on real life
project? I think that now would help me books or tutorials that are treating topics on surface.
I want to mention that also I had installed, connected and tested a local database trough c++ and some years ago I installed an local apache server and played with html, php.
Guide me please on what tools I have to learn next to be able to enter on the market, now I am working on another technical field and I want to gradually sustain myself from programming.
Thank you în advance for your help.
|
|
|
|
|
If you have finished the book - and done all the exercises - then you are ready for a bigger, more in-depth book: Petzold is excellent, but only an introduction! Addison Wesley, Wrox, and MS Press all do excellent books on C#, but they tend to average around the 1000 page mark rather than 250 odd of Petzold!
Experience is the key: practice, practice, and then practice some more - C# is a pretty small language (you can learn the whole of it in an afternoon if you have solid C++ OOPs experience) ... but the .NET framework is enormous, and comes in several flavours now, as do the presentation framework part of it (WinForms, WPF, Blazor, Xamarin all target differently and what works in one doesn't work in the other!)
So decide what framework you will specialise in to start with, and get a book on that - then practice, practice, practice! You can always add a second presentation framework later when you have solid experience under your belt.
Good luck!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
To support what Griff has already said, the thing you need to do most in order to enter the market as a professional developer is to create working applications. Find projects that pique your interest. There are plenty of articles here on CP that represent working applications.
Look at the CP home page. Set your filter to C#, and then browse the articles that it shows. Good luck!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thank you for your responses.
Blazor seems intresting because it is used for frontend and for backend development, this thing looks atractive I will take a look on it.
Thank you for your time.
|
|
|
|
|
coco243 wrote: Blazor seems intresting because it is used for frontend
I suggest javascript rather than that. There is more market for javascript.
|
|
|
|
|
imho, you need to make decisions about:
1) type of app(s): windows, mac, linux ... or, app that runs on all those, or, only runs in browsers.
2) if you choose the .NET framework, language choice gets easier.
3) front-end, and/or back-end ? MS facility or non-MS backend tools ?
i suggest you start by using WinForms ... get familiar with interacting with controls using events ... understand inheritance (classes, subclasses), and using interfaces. study use of abstract and virtual.
There excellent books on learning C# WinForms.
imho, what you learn will help you move to another .NET language and/or .NET framework.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
When I finished to read the C# introduction book thats were the questions în my head, to start with UI windows programming or web developing?
The ideea is that I've spended a lot of time with C++ and WINAPI without
succeding entering in the freelanging programming market and now I wish to get the way that leads me to be able to work and make an income while I am adding more and more knowledge, I want to learn tools that help me not those that pushes me away from my goal.
Thank you
|
|
|
|
|
coco243 wrote: I want to learn tools that help me not those that pushes me away from my goal. i've given you my best advice ... how long are you going to sit by the river, thirsty, thinking about what's the best water ?
Make choices, and get to work. Research skills most in use now, that companies are hiring entry-level positions for.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Forget about freelancing for the moment, you are focusing on the wrong issue. Decide whether you want to do desktop or web apps and get learning and practicing on the skills you need for whichever path you choose. Then find a job that will increase your learning and experience and give you a solid grounding in the commercial world. Only then will you have the necessary attributes to consider looking for freelance work.
|
|
|
|
|
I "reimaged" myself along your line of thought but scanned the web sites first to determine where the demand lay. I went for (small) fixed bids, to open hourly (no web cams or keyboard loggers, thank you) ... then took that experience and parlayed that into independent long term contracts. All remote. I focused on .NET at the time which has carried me for the last 15+ years.
I'd become an "AI expert" today ... but I think half of it is a con. Ethics.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Yey Gerry, something like that I am doing now, for the moment I have started some blazor tutorials on microsoft site to see what blazor can do and what can I do with it and also I pay attention on some freelancing sites to see the demand.
|
|
|
|
|
I'm refactoring some code that imports Google contacts. This screenshot[^] shows the parameters being sent. It is identical to the previous version, with the exception of the Client Id and Client Secret.
Now, for some reason, I'm getting this:
Google.Apis.Requests.RequestError
Request had insufficient authentication scopes. [403]
Errors [
Message[Insufficient Permission] Location[ - ] Reason[insufficientPermissions] Domain[global]
]
This appears to be complaining about the scope, yet it's hasn't changed. Not sure if that's what this message means.
I've been Googling & reading the docs, and I don't see what's wrong. I'm really stuck on this. Can someone point me in the right direction?
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
If you are refactoring code, and it worked before you started, then the obvious thing to do is go back to the original code and compare it to the refactored version - it's quite likely that scope for a variable has changed and it was (or is) "hiding" the required value, or perhaps you a missing a call that you needed before.
But without the original and refactored code, there really isn't anything we can do!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The code is different because Google changed their auth process.
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
That's not refactoring!
Refactoring is the process of restructuring code, while not changing its original functionality. The goal of refactoring is to improve internal code by making many small changes without altering the code's external behavior.
You need to find out what the new process involves, and upgrade the code to be compliant. At a guess, Google will have a list of changes that need to be made - I'd start there, or ask their tech support.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
try
{
string message = "device=camera;item=ois;command=start;\\r\\n";
byte[] bytes = Encoding.ASCII.GetBytes(message);
Socket s = null;
IPEndPoint hostEndPoint;
IPAddress hostAddress = null;
int conPort = 80;
hostAddress = IPAddress.Parse("127.0.0.1");
hostEndPoint = new IPEndPoint(hostAddress, 9103);
s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
s.ReceiveTimeout = 1000*15;
s.Connect(hostEndPoint);
if (!s.Connected)
{
Console.WriteLine("Unable to connect to host");
}
s.Send(bytes);
s.Close();
}
as my thought, the data should be sent out after sockct.send. but actually it don't work. the data been sent out after socket.close. i had been stuck by this 2 days. i had searched information using bing and google 2 days, nothing useful. it is suffering. it is appreciated for any suggestion. thanks.
[edit]
Closing <pre > tag added - OriginalGriff
[/edit]
i want to best
modified 5-Jul-23 0:10am.
|
|
|
|
|