I want to write an SP that I will use in my c# program. I have three tables: Table1 (id pk, name, …), Table2 (id PK, name, …) and Table3((idT1,idT2) PK FK). So, Table3 models the n:n relationship …
Tag: c#
How to force extenal library to use SQL transaction
I have an external library to which I pass an instance of System.Data.SqlClient.SqlConnection and I want to wrap everything that library does on that connection in a transaction. When I was working …
SqlException: invalid column name even though it’s not the column
I am trying to insert basic data into my MSSQL database but I keep receiving this error: System.Data.SqlClient.SqlException: ‘Invalid column name ‘Common’. Invalid column name ‘Bug’. Invalid column …
choose a few id from db C#
I have a database and excel file And I want to export strings to excel How to export strings with 1 id I know The code you can see below _Hours = Rep.Where(o => o.Projects.ProjectGroupID == 4)….
Only returning one record in dataset
I am using ado .net in my web API and dapper and I have a function that checks the orders and the order lines it works fine if their only one order but if there an order without order lines it won’t …
Avoiding SQL Injections with Parameters by C#?
I have recently adjusted my code to avoid getting SQL injections for maria db and got helped with adding parameters ,when I using parameters method page got running time error I am relatively new to using maria db so any help is appreciated Answer If you want to avoid SQL injections, another approach besides parametrized queries is stored procedures. You
Decimal value gets rounded when entering DB
I’m trying to upload a decimal value into a database. Before the upload (while debugging C#) it’s decimal but when inserted to the database it’s the decimal is rounded so there aren’t any numbers …
Can’t convert SQL VARBINARY to byte[] correctly and convert to Image in ASP.NET c#
Here is what I’m doing: public static MVC_Picture GetPictureRecord(int pictureID) { int pictureId = pictureID; MVC_Picture _picture = new MVC_Picture(); //object that stores name and array …
How to merge two rows having same data?
i have a table with some data i want to merge the identical row i.e.as shown in image two identical rows having same tDateWorked,empid,jobid i want to merge this records so that OT and ST should …
Arabic Text Shows Encoded
I have a problem that file encoding was windows-1256 and it shows strange text when using ie11 and arabic text, so i changed the file encoding to utf-8 and it works fine but i need to convert back the …