Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
97 views

I am working on a project where I need to combine data from 2 different databases on the same server. I am using the System.Data.SqlClient library, utilizing SqlConnection and SqlCommand. I have ...
Keith Clark's user avatar
0 votes
0 answers
49 views

I have this commad that where id=333 how can I attach a string that will automatically put 333 with a sql query string constr = ConfigurationManager.ConnectionStrings["PTS_Metcom"].ToString()...
Kaan Tursucu's user avatar
0 votes
1 answer
57 views

using (var command = new SqlCommand("INSERT INTO TMateriales (NumMateriales, CodMateriales, NamMateriales, IslocalPMateriales, IdCategries, IsDepoMateriales, MadMateriales, PriceMateriales, ...
SEKO's user avatar
  • 1
0 votes
0 answers
81 views

I'm trying to have a DataGridView in my Windows Forms showing data from the database, but it doesn't want to run. namespace DentalClinicManagementSystem { class MyPatient { public void ...
CatD's user avatar
  • 1
-1 votes
1 answer
430 views

I am refactoring some code that used reflection to map a SqlCommand to a model. The new code uses the Dapper framework and works perfectly fine: Public Shared Function GetModel(Of T As New)(cmd As ...
Vincent's user avatar
  • 2,103
1 vote
1 answer
698 views

With \help or \h below, I could show the SQL commands as shown below: \help Or: \h postgres=# \help Available help: ABORT CREATE USER ALTER AGGREGATE ...
Super Kai - Kazuya Ito's user avatar
1 vote
1 answer
84 views

Create a view named HighBalance using the the patient number, last name, first name, street, city and zip code for those patients with a balance greater than $1,000. Display the data in the view Im ...
Skeeball 1987's user avatar
0 votes
0 answers
114 views

I'm trying to figure out on the proper way for the additional string validation. I have an SQL query below which is compiled on c#, detected by Checkmarkx application that the Row.Cells[2].Text is not ...
Lia Lucindia's user avatar
-1 votes
1 answer
140 views

I have to read a value from a simple T-SQL stored procedure. When I test the procedure in SQL, it works fine. But when I try to read by a C# SqlCommand, it returns a wrong value that is always 0 (zero)...
Riccardo's user avatar
0 votes
4 answers
123 views

I have the following table in SQL: I want to remove rows with the same id value. Which query in SQL should I use? The table should be as follows after the delete operation:
user's user avatar
  • 136
0 votes
2 answers
166 views

I'm trying to do a raw SQL statement which resembles this DELETE FROM db.T0590_CODE_STRING WHERE IN (1,1,2,3,5) the values in the IN clause are from rowIds list so therefore I'm trying to use a ...
Bouyalife's user avatar
0 votes
1 answer
54 views

Code: x = int(id_[0]) select_query = "SELECT * FROM files WHERE id = %s" cursor.execute(select_query,x) results = cursor.fetchone() I am using mySQL in Python. This is the error I get: ...
Tamer Vassib's user avatar
0 votes
1 answer
90 views

I want to store to a column a value from string to number I have this part of code in c# //Order string refId = order.id.ToString(); ApplicationLogger.Write("order.date_created : " + order....
ΙΩΑΝΝΗΣ ΡΙΣΒΑΣ's user avatar
0 votes
0 answers
693 views

I have a data transformation application where one of the first steps is for the user to paste in a valid SELECT statement. After it is verified, the app will execute it against their database and ...
Skattch's user avatar
  • 19
-1 votes
2 answers
190 views

Type entryEntityType = entry.Entity.GetType(); string tableName = GetTableName(entryEntityType); string primaryKeyName = GetPrimaryKeyName(entryEntityType); string deletequery = string.Format("...
Radha's user avatar
  • 81
0 votes
1 answer
2k views

I need to filter a sql request by passing a list of id to , this is the command: var command = "select Software.Name as SoftwareName,SoftwareType.Name as SoftwareType from AssetManagement.Asset ...
A.HADDAD's user avatar
  • 1,917
2 votes
1 answer
76 views

In a situation like this: SqlConnection cn = new SqlConnection( ConfigurationManager .ConnectionStrings["AppConnection"] .ConnectionString ); using (cn) {...} Will the using() ...
KWallace's user avatar
  • 1,730
0 votes
0 answers
57 views

I am running a relatively simple query using SqlConnection / SqlCommand / SqlDataReader. The code looks like the below. I have this inside of a function where I pass in a date to call this function, ...
Eugene's user avatar
  • 153
-1 votes
1 answer
52 views

I am trying to enter a list of data objects to my table using a loop. But during the loop, the logic abruptly stops with this error: There is already an open DataReader associated with this Command ...
Jay's user avatar
  • 5,114
0 votes
2 answers
238 views

protected void gridOmniZone_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = gridOmniZone.Rows[e.RowIndex]; Int64 ID = Convert.ToInt64(...
user avatar
0 votes
0 answers
109 views

I have such code: private DbTransaction sqlTransaction = null; ... ... ... using (DbCommand command = new SqlCommand("SELECT @@TRANCOUNT")) { if ((int)command.ExecuteScalar() != 0) ...
Aleksandr Romanov's user avatar
-1 votes
2 answers
351 views

How can I fix the vb.net error "array bounds cannot appear in type specifiers" in the following code? Dim con As New SqlConnection("Data Source=localhost;Initial Catalog=WebAssignment1;...
Putu Widianingsih's user avatar
1 vote
0 answers
73 views

I'm working on an application that uses C# to do a search like so: using (SqlCommand cmd = new SqlCommand("[dbo].[usp_Search]", commercialConn)) ...
awimley's user avatar
  • 712
1 vote
1 answer
253 views

The Microsoft Documentation for the SqlCommand class gives the following example code which does not dispose of the SqlCommand. SqlCommand inherits from DbCommand which implements IDisposable. Common ...
Aaron Anodide's user avatar
-2 votes
1 answer
1k views

I am trying to create a SSIS package that makes a call to the REST API and insert the responses into the Azure SQL server table. For this I am using the script task and ADO.NET connection manager. The ...
user4912134's user avatar
  • 1,053
0 votes
1 answer
1k views

I would like to add a [bit] field that is calculated from a Boolean [int] field SQL Table looks as follow: CREATE TABLE [dbo].[AutoIndexBoolean]( [RowID] [int] NOT NULL, [Boolean] [int] NULL, ...
Evan's user avatar
  • 3
0 votes
3 answers
78 views

I have a table: Name | account info| AccountNumber -----| ------------| ------ abc | IT | 3000 bdc | Desk | 2000 sed | Kitchen | 3000 afh | work | 4000 hsfs | home ...
Jeff's user avatar
  • 125
1 vote
1 answer
140 views

I'm executing a sql script using: SqlCommand command = new SqlCommand(sqlQuery, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); if(reader.HasRows) { while(reader....
Jeff's user avatar
  • 125
1 vote
1 answer
1k views

I am looking to concurrently read and update records from a database. At this point, I have a sample program set up that grabs records from a database with a certain status. I am aiming for the rows ...
noahsrc's user avatar
  • 23
-1 votes
1 answer
617 views

I get this error: System.Data.OleDb.OleDbException (0x80040E14): Syntax error (missing operator) in query expression ''O'Brien','O'Brien''. at System.Data.OleDb.OleDbCommand....
Dinesh Kumar's user avatar
0 votes
1 answer
106 views

private void button1_Click(object sender, EventArgs e) { object functionReturnValue = null; using (System.Net.WebClient client = new System.Net.WebClient()) { System.Collections....
kenluffy32's user avatar
0 votes
1 answer
120 views

What I am trying to do, is query from my database and populate the columns inside my Index.cshtml. Below is my code: This is from my HomeController: SqlConnection con = new SqlConnection("Data ...
yongchang's user avatar
  • 511
1 vote
1 answer
5k views

public static String AccountNumber; public static double oldBalance, newBalance; SqlConnection connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\CSharp\ATM\...
Ranvoxrat's user avatar
2 votes
0 answers
360 views

I have an old solution running on LINQ-to-SQL (DMBL), where I want to delete a large amount of rows based on id's (incl. a lot of referenced objects). But the traditional way of using DeleteOnSubmit ...
baddaydaddy's user avatar
0 votes
2 answers
2k views

I have a stored procedure in my database: ALTER PROCEDURE [dbo].[SP_UPDATE_PARAMS] (@ELEMENT NUMERIC (10), @NUM_PARAM_OP_DINT NUMERIC (3,0) OUTPUT, @NUM_PARAM_OP_REAL NUMERIC (3,0) ...
LSG's user avatar
  • 127
1 vote
1 answer
2k views

I have a stored procedure which uses a table valued parameter (tvp). In my application, I use a datatable as a SqlParameter to match the tvp structure. The problem is that it sometimes takes 25 ...
Conorou's user avatar
  • 31
1 vote
4 answers
457 views

var sqlCommand= "@ DELETE FROM table1 WHERE id = @Id DELETE FROM table2 WHERE id = @Id "; var isDeleted = db.Database .ExecuteSqlCommand(sqlCommand, new ...
Fanny Hunayn's user avatar
-3 votes
2 answers
868 views

This is my code: private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = "data source = LAPTOP-ULT25NKH; database = ...
amandi yalapola's user avatar
-1 votes
1 answer
253 views

I'm trying to build a Form that can insert images to local DB and load them to flowLayoutPanel. Here is the layout of my form, I insert images in 'admin' tab (pic.1). In 'Browse Photos' tab I try to ...
YS Chang's user avatar
0 votes
1 answer
827 views

I have this SP (extremply simplified for exhibit) SELECT colA, colB, colC INTO #MyTable select COUNT(*) from #MyTable On the C# side, I have int total = 0; var command = _context.CreateStoreCommand( ...
user2687153's user avatar
0 votes
1 answer
798 views

I'm working on an application, reading tables in an MS-SQL database. Normally this way of working is fine: sqlCommand.CommentText = $"SELECT {Col_Name} FROM {variable}"; sqlReader = ...
Dominique's user avatar
  • 17.6k
0 votes
0 answers
64 views

I have an Excel worksheet with several queries, where I enter a date format several times per query. When I produce the data for May I input '2021-05-31' several times, and when I want to produce data ...
Attp30998's user avatar
-1 votes
1 answer
134 views

On a C# project (.NET Framework 4.8) when I try to create a control SqlCommand using the designer I get the following error Failed to create component 'SqlCommand'. The error message follows: 'System....
CHRISTOS STAVRINOU's user avatar
0 votes
2 answers
288 views

I'm having connection pool issues on my service (max reached), everywhere that I try to open a connection I wrap it on a using statement to dispose it correctly, but I think something is not allowing ...
qhart's user avatar
  • 29
0 votes
1 answer
48 views

I have a table sample with column 'observations': Please help with the SQL command to get the following 'cumulative multiplication' output: 2 6 30 300
Dynamo's user avatar
  • 51
-1 votes
1 answer
137 views

There is a matching record in the DB for DESKTOP-123\\markj. When I execute the code in SQL Server Management Studio, it returns one record. DECLARE @User NVARCHAR(260) = 'DESKTOP-123\\markj' SELECT ...
MaxPowers's user avatar
  • 504
0 votes
2 answers
90 views

In my table I have Voucher, Dimension and Amount. Each Voucher is unique, and Dimension is usually similar per two Vouchers. There is also usually an identical positive and negative amount per Voucher ...
Attp30998's user avatar
1 vote
1 answer
255 views

Here's the query that I need to perform: SELECT COUNT(*) FROM Faq WHERE IdApplicazione = @IdApp AND (TestoDomanda LIKE '%search%' OR TestoRisposta LIKE '%@search%') I'm trying to perform it in C# by ...
AutomationNeeded's user avatar
1 vote
1 answer
564 views

I have to modify a SQL Server database dynamically, depending on some inputs. What I wanted to do is to generate the modification commands and then execute them. And, to avoid SQL injection, I wanted ...
xecollons's user avatar
  • 618
0 votes
0 answers
429 views

I'm trying to insert data into my SQL Server 2014 database. I wrote the SQL query with the @parameters and used the SqlCommand.Parameters.AddWithValue to parse the values, without worrying about SQL ...
M. Ulus's user avatar
  • 11

1
2 3 4 5
19