Posts by Marco Souza • 12,304 points
506 posts
-
2
votes4
answers582
viewsA: Entity Inner Join in LINQ
You can create an extension method to do this. Call it that. context.LoginsAtivos .Vw_LoginAtivoLogin(context); Like a View. public class vw_LoginAtivoLogin { public LoginAtivo loginAtivo { get;…
-
9
votes1
answer3234
viewsQ: What is dynamic SQL?
I have seen many cases where some show how to use, and others where they simply advise against using SQL dynamic. I had the following doubts: But anyway, when we should or should not use dynamic…
-
2
votes1
answer199
viewsA: How to launch custom T-SQL exception?
Matheus, the SQL SERVER does not have a function for validation of CPF or CNPJ, these types of numbers are Brazilian standards and are not applied to other countries, so a function of this type…
-
5
votes2
answers1003
viewsA: Can Sqlite work fully offline?
Sqlite can work fully offline? Sqlite is a library in c language which implements a built-in SQL database. Programs that use the Sqlite library can have access to SQL database without running a…
-
4
votes1
answer2399
viewsA: Dynamic Sql Server Query
You need to fix your query in the like , For example; select * from tabela where like '%dado%'; Make the data between '%% % ' in your case the query is being mounted without the '' . select * from…
-
0
votes2
answers1402
viewsA: How to change Link color in HTML?
That’s coming together because you’re wearing bootstrap.min he has an element Anchor (a) , with a preset color if you want to change the color you will have to override its rules or change in itself…
-
3
votes2
answers9251
viewsA: How to check a null position in the vector
There is a fundamental difference between a null matrix and an empty matrix . This is a test for null . int arr[] = null; if (arr == null) { System.out.println("array is null"); } For you check…
-
2
votes4
answers1988
viewsA: Is there any way to know if I’ve done git push?
I’ll leave this here in case you want to create a password cache. Why does Git always ask for my password? If Git asks you for a username and password every time you try to interact with Github,…
gitanswered Marco Souza 12,304 -
3
votes1
answer759
viewsA: How to save the values of a String in a Double variable?
The parseDouble method is the most used to make this type of conversion. public class ConvertStringToDouble { public static void main(String[] args) { String aString = "700"; double aDouble =…
-
17
votes4
answers1174
viewsA: How do I share a Java project with a team?
If you want to host your source code in the cloud and don’t want to shell out a good gravel for this can be the solution you seek. TOP 5 FREE SOURCE CODE REPOSITORIES FOR YOUR SOFTWARE. Github - git…
-
0
votes1
answer574
viewsA: Receive and Send JSON C#
Practically you need some statements for your Webservices to work. [Scriptmethod(Responseformat = Responseformat.Json)] Specifies the HTTP verb is used to call a method and the answer format. This…
-
1
votes4
answers1102
viewsA: How to show data from 2 tables in a grid?
You only need to make a sub query with the categories. using System; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Web.UI.WebControls; namespace stackoverflow {…
-
2
votes1
answer894
viewsQ: Tryparse error of Datetime converting string in Double format
I have a method of using the DateTime.TryParse to convert a string for the guy DateTime, but lately I’ve realized that string format Double would also be being converted to date. Is there any…
-
1
votes2
answers348
viewsA: Check the number of people per age
You can use the between to filter the age range you want. create PROCEDURE BuscarTotalIdadePorFaixa @iniIdade int, @fimIdade int AS BEGIN SET NOCOUNT ON; declare @pessoa table(idade int, qtd int)…
-
13
votes3
answers1511
viewsQ: How can I replace a part of a string by itself plus the "~" character?
How can I replace a part of a string by itself plus the character "~"? I’m doing it this way: only when the string has two equal numbers as the 51 that comes just after AP and the contained in the…
-
2
votes1
answer838
viewsQ: How to validate Date with Regex?
I am trying to capture a date inside a string using regex, but when I try to recover the part of the string returns me the following error: analyzing " TARIFF:([ d/]+)" - Unrecognised exhaust…
-
2
votes3
answers176
viewsA: SELECT in two tables, with ID separated by comma
In that case, you can create a FUNCTION that returns a string with the name of the colors passing the IDS that you want, as follows. create FUNCTION StringListToTexto ( @List varchar(MAX) ) RETURNS…
-
1
votes5
answers29127
viewsA: use if in sql server
You can do the way you’re doing, the only difference is that in sql you only use one = to compare. declare @tipocliente int = 3, @CLIENTE int = 1, @Distribuidor int = 2, @exportaçao int = 3 if…
-
2
votes1
answer247
viewsA: Problems passing a list of objects to another list
You can create something like this. And add your list like this. -- Sua primeira pessoa INSERT INTO [dbo].[Pessoas]([Nome],[Idade],[Telefone],[CPF]) VALUES('Carlos',21,'1122223333','345.322.234-54')…
-
1
votes3
answers783
viewsA: How to return values from two different tables?
You can use the SelectMany for merged their values, only the one question that would be for a case where db.packages.Where(p => p.title.Contains(search), is compared with a variable of the…
-
2
votes2
answers681
viewsA: How to record a txt file with each patient’s name?
Just change the variable nameArq with the name you want. public static void main(String[] args) throws IOException { Scanner ler = new Scanner(System.in); String nomeArq="Relatorio.pdf"; int i;…
-
0
votes2
answers187
viewsA: Checks if in a value group there is a value x mysql
You can add one more AND between () its values separated by OR as follows. SELECT pessoas.id AS ID, pessoas.nom_pessoa AS nome, pessoas.cod_sexo_pes AS sexo,…
-
1
votes4
answers15280
viewsA: Can you create an array in SQL Server?
The only way I know is how you spoke, create (User-defined TABLE type) as follows. CREATE TYPE [dbo].[tp_IDsTable] AS TABLE( [Id] [int] NULL -- mais campos ) GO create PROCEDURE TestePassandoArray…
sql-serveranswered Marco Souza 12,304 -
1
votes1
answer358
viewsA: I can’t find the smallest number
The easiest way to do this is to add your numbers to an Integers array and then use Collections.min and Collections.max. if (num > 0) { Integer[] numbers = new Integer[num] for (i = 0; i <=…
javaanswered Marco Souza 12,304 -
1
votes1
answer142
viewsA: How to join 4 tables in SQL that is returning empty ? (Inner, Outer or left Join )
Your query returns exactly what you are asking in the question. --Variation -- id | product_id | size_id | color_id | quantity | barcode --…
-
0
votes4
answers83
viewsA: Only join if the above query returns records
Only if you use the table above to filter the second declare @Tabela1 table ( id int ) declare @Tabela2 table ( id int ) --insert into @Tabela1 values (1),(2),(3),(4) insert into @Tabela2 values…
-
1
votes2
answers232
viewsA: Mysql Query - Two tables and date range
You can use the left join to bring all the TECHNICAL, and a Case to verify who has the task or who does not. declare @TECNICO table ( cd_tecnico int, nome varchar (30) ) declare @TAREFA table (…
mysqlanswered Marco Souza 12,304 -
0
votes2
answers114
viewsA: Return vehicles that have all parts in a given table
The query below would be an example of how to do this. --| veiculo | --| idVeiculo | placa | --| peca | --| idPeca | nomePeca | --| relVeiPec | --| idVeiculo | idPeca | --| pecaObrig | --| idPeca |…
-
0
votes2
answers217
viewsA: Include a digit before the phone in the BD register
I don’t know if it will work with Mysql, but in sql server I would do it like this. declare @Celular varchar(14) = '(21)9999-999' declare @NovoCelular varchar(14) set @NovoCelular = case when…
-
3
votes1
answer50
viewsA: Error retrieving SQL data
Surely you’re not making the relationship right. See in your Where you do: (((Colaborador_1.IdColaborador)=[Colaborador].[IdColaborador])) This will make a JOIN with the same data as your…
-
0
votes1
answer1758
viewsQ: How to build menu and sub menu?
How to show a sub-menu inside another? <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Início", "Index", "Home")</li>…
-
1
votes2
answers135
viewsA: javascript Prevent from Submit
You must have something like: OnClientClick = "IsNull" function isNull(e) { if (it is null) e.preventDefault(); else ... }
-
2
votes5
answers4348
viewsA: How to access the value of an array through the key?
If objects are inside an array var ArrayValues = [ { objeto }, { } objeto , ...] ; The following regular parent advisors will work: var Valordavid = arr[0].David.toString(); var Valorcamilla =…
-
4
votes1
answer5453
viewsA: Check if date is between a period
You can use the between it specifies a range to be tested. Syntax: test_expression [ NOT ] BETWEEN begin_expression AND end_expression Arguments? test_expression Is the expression to be tested in…
-
2
votes2
answers200
viewsA: How to select the foreign key id in the main table?
What you need is a JOIN, to obtain the name of the Driver on the secondary table. Select C*, M.NomeMotorista from Caminhao C -- Corrija o M.NomeMotorista para seu campo join Motorista M on…
-
1
votes1
answer30
viewsA: Error loading file with File Editor
I believe what’s left is for you to read the file. Insert the following line into your code and test. Reader.readAsText(file); var loadFile = function(name) { fileSystem.root.getFile(name, {},…
-
0
votes3
answers372
viewsA: List dates calculated per month based on parameters
You can use the DATENAME passing the weekday returns the name of the week varchar and DATEPART passing the weekday to return the week in a int declare @StartDate datetime = 2016/01/15 SELECT…
-
0
votes3
answers795
viewsA: How to do a query that only refers to the DIA of a date?
You can use the DATEDIFF to do this. In the function you have to use the current date in the first parameter in the second you add the total of days you check the current date ie 5 . DATEADD(day,5,…
-
0
votes2
answers207
viewsA: Procedure "complex"
I go this way not exactly as an answer, but by formatting. Well, by the standard PROCEDURES should not return values, but if you are going to do this you have to select it in the final statement.…
sqlanswered Marco Souza 12,304 -
5
votes3
answers218
viewsA: Possibility to create 200 columns in a database
Given the issue Here You can create as follows. There is not much secret, what you need and have your table with the questions and others with the question options, another with User, as a user can…
-
11
votes6
answers37862
viewsA: How to remove characters from a string?
How will you remove a specific character from a String using another String, you will need to make a loop to travel the String which has the characters "hollow" to check in its second String…
-
1
votes1
answer306
viewsA: TABLE TUPLA RELATIONSHIP TABLE 1:1
As the question has little content, so an image is worth a thousand words. More details Here.…
databaseanswered Marco Souza 12,304 -
1
votes2
answers614
viewsA: Enter data into a foreign key table
Your bank has the need to have such a relationship? You see, the right thing would be for you to have a Users relationship to Addresses 1:N, namely a User may have more than one Address. That way…
-
2
votes2
answers539
viewsQ: Context Dispose should be used in ASP.NET MVC?
In the Web Forms every time I’ve assembled some kind of CRUD, used the using to make an implicit Dispose(). public List<Produtos> Lista () { using (var ctx = new DbContext()) { return ctx.…
-
1
votes3
answers756
viewsA: Linq, doing Join comparing to Like
You can use the method Contains to do this. using (var DBCtx = new RohrdbContext()) { var s = (from p in DBCtx.exemplo1 from q in DBCtx.exemplo2 where q.blablablabla.Contains(p.blabla) select p); //…
-
4
votes1
answer115
viewsA: QUERY containing different and or
You have to use the IS NULL when you want your search to return only values NULL or IS NOT NULL when you want only return different values of NULL. changes the lines. and FLG_STATU_PESSO <>…
mysqlanswered Marco Souza 12,304 -
54
votes4
answers17728
viewsQ: What is a scaffold?
I started studying ASP.NET MVC and came across the term scaffold, but I didn’t understand it very well, so: What is scaffold? What is its use within ASP.NET MVC?…
-
1
votes1
answer151
viewsA: Is there a way to name the selected tables from a stored database to identify them in the Dataset?
You can use sets of datasets or tablemapping something like that. SqlDataAdapter da = new SqlDataAdapter(...); DataSet ds = new DataSet(); DataTableMapping dtm1, dtm2, dtm3; dtm1 =…
-
0
votes1
answer224
viewsA: How to show result between 3 tables?
declare @table_1 table ( ID1 int, name varchar(100) ) insert into @table_1 values (1 , 'xxxxx' ) ,(2 , 'xxxxxx' ) ,(3 , 'xxxxxxxx' ) ,(4 , 'xxxxxx' ) ,(5 , 'xxxxxx' ) declare @table_2 table ( ID1…
-
2
votes1
answer339
viewsA: Integration of Web Service Information
I already have my methods to perform CRUD operations ready in a class . that were used in a Windows Forms application You can use yes, just call them within a web services method. From what I…