C
C#2y ago
Krimo

❔ Syntax error, datagridview shows nothing

I've been working on winform application and had troubles of showing info fro a db to a datagridview. Didn't know what do so I played around. Now when I run the app i get an error. Cant quite see what the problem is. Any suggestion for a better query?
4 Replies
mtreit
mtreit2y ago
That trailing comma in your concat function call might be a problem. Also this is SQL injection which is a bad habit to get into. I understand for learning projects doing it the "right" way is a bit of a pain, but you might want to learn how to do parameterized SQL instead of concatenating user input that could do terrible things to you database.
Krimo
Krimo2y ago
Yeah the comma was the problem, thanks. The datagridview didn't show any data where "concat - like" query but did with only (select * from tbUser). Why is that?
mtreit
mtreit2y ago
Perhaps your query returned zero rows.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ Invalid Data Exception when extracting filesI am getting a `System.IO.InvalidDataException: Found invalid data while decoding.` error while runn❔ VS crashes when i try to add web browserim using windows forms and when i try to add web browser visual studio crahes❔ [Homework] Console Game HelpHello! I'm a newbie to coding (CS Freshman) & I have this project to submit tomorrow (4th Dec.), inv✅ Newtonsoft.JSON correctly serializes data but erroneously leaves out arrays during deserializationMy simplified code is as follows: ```cs public class Building { public string K❔ IAsyncEnumerable and IQueriable unit testingI have an interface of the repository, which has a method Query<T>. This method should return IQuery❔ Generics with different input and output typeI'm writing a generic at the moment which it something like this: ```csharp T GetSomething<T, U>(U I❔ Can I use slice operator with loop index (remainder operator%)?I want to slice an array from start to end index but if end index exceeds the array length, loop it ❔ My ASP.NET project isn't launchingI just made templates for a Standalone Angular project and a ASP.NET 6 project but it seems like onl❔ Making properties accessible by both static and non-static methodsI had to make a static duplicate of a property, because I wanted it to be accessible by both non-sta❔ Windows Forms different controls but same event doing different code?```cs private void OnSecondsChange(object sender, EventArgs e) { textBoxUpTime.Text += $"{sender