Questions tagged as 'sql-server'

1
answer

Read data from a column through C # [closed]

I have a postal code and divided it into 2 variables: the first, where the first 4 numbers appear and the second one where the last 3 appear. Ex:    4300-234 - first = 4300 ; second = 234 . I have a table in the database that has 3 c...
asked by 18.04.2017 / 17:47
2
answers

Updating sqlsrv datetime field

I need to update the date in the field date, of type datetime, in a table, taking the date of today, for example. I'm trying to do this: $dataHoje = new DateTime(); $sql = "UPDATE [RDO].[dbo].[ANALISE_CRITICA] SET TXTOBS='$objetoExtra...
asked by 22.10.2014 / 19:01
2
answers

Can anyone explain this error to me? [closed]

I have 2 tables, products and suppliers. And the following message is appearing:    System.Data.SqlClient.SqlException: 'The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Products_Provider". The "C: \ USERS \ TIAGO \ DOCUMEN...
asked by 22.05.2018 / 02:28
1
answer

How can I make an if if DataBase data is True or False

How can I do an if checking if the data in a column in the DataBase table is True or False? For example: using (SqlCommand cmd = new SqlCommand($"SELECT LoginID,Award FROM Sys_Usuarios_Award WHERE LoginID={login.LoginId} and Award='true ou...
asked by 12.03.2018 / 14:45
1
answer

C # - Pass only numbers in a currency formatted field

I have an application that shows me in a textbox the value of a course enrollment: string mensalidade = string.Format("{0:C}", Convert.ToDouble(leitura["Mensalidade"])); cursoSelecionado.Mensalidade = mensalidade; tb_Mensalidade.Text = Convert...
asked by 13.03.2018 / 23:16
1
answer

Non-repetition of SQL SERVER code

I have the following code in sql server. I need to make it in the first if it exits and execute the same statement that is inside the else tag so as not to repeat the code it has in there. How do I do this? DECLARE @AG_NUM varchar(15) DECLARE...
asked by 02.04.2018 / 14:45
1
answer

How to create a shopping cart in ASP.NET MVC [closed]

Good evening! I'm doing an ASP.NET MVC project and I really need to create a shopping cart to get all the items the user clicks on add to cart, for example the product will be on the index page, the user clicks add to cart and the data with prod...
asked by 04.08.2017 / 01:01
1
answer

Incorrect syntax near ','

The code is this: <i> <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include virtual="aplicativos/arquivos.asp"--> <!--#include virtual="aplicativos/JSON_UTIL_0.1.1.asp" --> <!--#include virtual="aplicativos/JSON_2....
asked by 01.11.2018 / 15:52
1
answer

Api to delete is not working, does not delete. A Stored Procedure on the bank is working

This is the API public class DeleteCidade { BancoContext banco = new BancoContext(); public void deleteCidade(int id) { banco.Database.SqlQuery<Cidade>("exec sp_del_cidade", new SqlParameter("@id"...
asked by 08.08.2018 / 21:43
1
answer

Retrieve the last 5 ids of the Sql Server database using entity framework?

How do I retrieve information from the last 5 Ids of the Sql server database using entity framwork? Controller public class VideoController : Controller { private DBContext db = new DBContext(); // GET: Video public ActionRes...
asked by 03.09.2018 / 14:18