how to get stored procedure response(with two tables) using linq?

I want to get stored procedure response using linq.But what my question is ,the stored procedure response having two tables,how to get two tables. below is my normal stored procedure: cmd = new SqlCommand(“[GET_User_ReloadCash_Details_UUid]”, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue(“@UUID”, UserUniqueID);//if you have parameters. da = new SqlDataAdapter(cmd); da.Fill(ds); // con.Close(); var Table1 = ds.Tables[0]; var Table2 = ds.Tables[1]; now I…
Read more

ASP.net c# SQL. If record combination exists in table, delete the records

i have a button on image detail page that allows the user to add said image to “favorites” which currently work, i just select the current querystring ID as the image id, and the session[“bruger_id”] as the users Id and insert it into a table called “favoritter” how i do it: protected void Button_favorit_Click(object sender, EventArgs e) { if (Session[“bruger_id”]…
Read more

How to prevent SQL injection when dealing with dynamic table/column names?

I am using jdbc PreparedStatement for data insertion. Statement stmt = conn.prepareStatement( “INESRT INTO” + tablename+ “(“+columnString+”) VALUES (?,?,?)”); tablename and columnString are something that is dynamically generated. I’ve tried to parameterise tablename and columnString but they will just resolve to something like ‘tablename’ which will violate the syntax. I’ve found somewhere online that suggest me to lookup the database…
Read more

Group together SELECT results in Postgresql

I have a table called moviegenre which looks like: moviegenre: – movie (FK movie.id) – genre (FK genre.id) I have a query (ORM generated) which returns all movie.imdb and genre.id‘s which have genre.id‘s in common with a given movie.imdb_id. SELECT “movie”.”imdb_id”, “moviegenre”.”genre_id” FROM “moviegenre” INNER JOIN “movie” ON ( “moviegenre”.”movie_id” = “movie”.”id” ) WHERE ( “movie”.”imdb_id” IN (SELECT U0.”imdb_id” FROM…
Read more

how to filter set on sum function in calculation mdx

I want to make calculation in olap cube in ssas. This will be “avg sku by outlets”. There is my expression: CREATE MEMBER CURRENTCUBE.[Measures].[Avg Prod Art Id Distinct Count By OldcID] AS Avg(DESCENDANTS([dimOutlets].[OLDC ID].CurrentMember,[dimOutlets].[OLDC ID].[OLDC ID]),[Measures].[Prod Art Id Distinct Count] ) It works fine, but i’m try to add some logic to it and some thing do wrong. I want…
Read more

Laravel 5 – Query with left join and subqueries

What I have I have a working Query, which I can run successfully as plain SQL command on my SQL server. SELECT i.hw_id , i.hw_hostname , i.hw_create_date created_at , uc.username created_by , he.hw_edited_date last_edit_date , ue.username last_edit_by FROM tbl_hw_inventar AS i INNER JOIN tbl_user AS uc ON i.hw_create_user_idfs = uc.id LEFT OUTER JOIN ( SELECT het.* FROM tbl_hw_edited AS het…
Read more

SQL Query help – display null values in SQL Sever 2012

My query is as follows: select iProduct, mPos_Outlet.sName, sum(fQrec + fQiss) as openingBalance from tCore_ibals_0 left join mPos_Outlet on mPos_Outlet.iMasterId = tCore_ibals_0.iInvTag where convert(date, dbo.IntToDate(iDate), 103) <= convert(date, ’23/03/2015′, 103) and iProduct = 5 group by iProduct, mPos_Outlet.sName My output is iProduct sName openingBalance ———————————– 5 S Road 11.0000000 I need all the stores to display with values as 0….
Read more

SQL Warning Code: -1100, SQLState: 02000

I am using HSQLDB with MVCC support enabled. In log files I am getting some warnings: [WARN i.SqlExceptionHelper] SQL Warning Code: -1100, SQLState: 02000 [WARN i.SqlExceptionHelper] no data Is there a mean to get a description of the problem based on the Warning code and/or SQLState? Source: sql