Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
2k views

In C# I'm trying to pass a DataTable as a parameter to an SQL statement. The code I have is below: protected virtual void DoDeleteRecords(List<Guid> ids) { if (ids.Count > 0) { ...
John P's user avatar
  • 349
1 vote
2 answers
1k views

SqlCommand cmd = new SqlCommand("Insert into [f_present] Values (@faculty_id, @name, @designation, @gender, @date, @status, @remarks)", con.active()); cmd.Parameters.AddWithValue("@...
Bhaskar Roy's user avatar
-2 votes
1 answer
50 views

private void btnSave_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=LoginDB;Integrated Security=True"); con.Open(...
Zeeshan Ismail's user avatar
3 votes
2 answers
1k views

I am trying to create a temporary database for the purpose of integration testing in Xunit, but when I try to drop the temporary database, I get an error: Cannot drop database "TempDatabase_[...
VeeTheSecond's user avatar
  • 3,176
0 votes
1 answer
48 views

I’m sorry about the nonsense question title, here is what i intended to asked: in c#: So i have a list that has integers(id’s), and i have a query string: myList //the list that has id’s in it. string ...
HydraCc's user avatar
  • 41
0 votes
1 answer
546 views

When I insert into a geography column with geography::STPointFromText, I have to dynamically build the column value, which ends up causing a SP:CacheMiss. My SQL cache is littered with singleton ...
Greg's user avatar
  • 4,125
-3 votes
1 answer
2k views

First of all, I passed the connection string to SqlConnection as parameter: SqlConnection con = new SqlConnection("server=ZIKO_RED2486;database=Students;Integrated Security = true"); Then ...
Dzeko's user avatar
  • 27
0 votes
2 answers
2k views

all. I am facing an issue on how to pass the dynamic parameter value from SQL query, that will be entered by the user into the textbox, to the SQL command to search on the parameter value on the ...
alice teh's user avatar
3 votes
2 answers
630 views

I am getting this error: System.Data.SqlClient.SqlException: 'The parameterized query '(@inputKarakterSoort varchar(8000))SELECT TOP 2 * FROM Karakter ' expects the parameter '@inputKarakterSoort', ...
user avatar
2 votes
2 answers
2k views

I have this ASP.NET Core project and in my DAL I collect my data from my database, but I want the user to be able to type a type character (Karakter is character in Dutch) and the DAL should pick 2 ...
user avatar
0 votes
1 answer
33 views

I have an SQL Query that i want to run throw my asp.net (WebForms) Project The Query is: SELECT COUNT([order]) FROM menu_orders_Finished WHERE [order] LIKE '%EXAMPLE%' What i'm trying to do ...
Anasib's user avatar
  • 1
0 votes
2 answers
345 views

I'm currently in the process of writing a small script that exports the event log of a program and writes it to a database. However, I am having problems with my SQL insert command. What am I doing ...
Jannik285's user avatar
0 votes
1 answer
831 views

I have written a generic VB.net subroutine that populates a datagrid with the results of a query. The subroutine as one parameter, strQuery, which is a string that can translate to any valid SQL-...
PeterF's user avatar
  • 47
-1 votes
1 answer
234 views

I've got a parameterized query which I build up based on selection criteria the user chooses on a web page. For example, here is an example query string (completeQuery) that is built: SELECT M....
B. Clay Shannon-B. Crow Raven's user avatar
1 vote
2 answers
4k views

I have a general question that I have not found any answer to. I think it is important to ask this question so I know how to structure the whole application so I am on the right track from the very ...
coding's user avatar
  • 63
0 votes
1 answer
1k views

I have created a SQL database named: DateTimes. The database is now filled in with this information seen on this image: As seen in the DateTime column, we can see those DateTime values in ascending ...
coding's user avatar
  • 63
0 votes
1 answer
274 views

I am doing an INSERT query to a db with the following code which works fine. public int InsertPerson(Person person, out string errormsg) { SqlConnection dbConnection = new SqlConnection(); ...
shurda's user avatar
  • 65
0 votes
0 answers
150 views

My .NET application uses SQLCommand to execute queries and the DB SPs. In one such SP that also returns the SQL 'timestamp' and that is read as byte array into the application. This byte array is ...
sandy's user avatar
  • 756
0 votes
1 answer
442 views

I am about to publish my first website, and I am kinda worried about SqlCommand and SqlConnection objects, they take too much space in the memory and might really overwhelm the server. What's the best ...
h3x0r's user avatar
  • 25
1 vote
0 answers
157 views

I have a table with INSERT INTO ABC("1000", "短消息"), I am able to execute it with SSMS but not with sqlcmd as it is accepting it and the output is [1000, J'aime] but not the Chinese ...
user avatar
0 votes
1 answer
720 views

I have 2 tables: WorkSchedule which has 2 columns WorkScheduleID and WorkScheduleStatus WorkShiftBid which has 3 columns: WorkShiftBidID, WSBidStatus, WorkScheduleID (foreign key to WorkSchedule ...
addsw's user avatar
  • 87
0 votes
1 answer
71 views

First question, I would like to implement two queries in one command. What is the correct syntax that should I followed? I tried this SqlCommand cmd = new SqlCommand("BEGIN;" + ...
Pepsi's user avatar
  • 19
-1 votes
2 answers
1k views

I am having issue to use SqlClient to call some sql query with parameter declared but not assigned. The query I want to run is similar to below DECLARE @ID int; SELECT @ID = OrderId FROM Orders ORDER ...
katrinawyh's user avatar
2 votes
0 answers
507 views

I use following pattern to work with SQL Server temp tables from .NET applications: Open the connection Create a temp table (only with ad hoc command!!!) Write a lot of data into it via ...
alex4711's user avatar
0 votes
1 answer
95 views

enter image description here I have a datatable as shown in the screenshot, and I want to search a Plant and Panel Tog Number for showing a Group and Coordination. At first I tried this: SqlCommand ...
Saran Deeluea's user avatar
0 votes
2 answers
66 views

CREATE table Patient ( Pat_number Number (30), file_no Number (30), Id_Card_No Number (30), Pat_name varchar(30), Date_of_Birth Number (30), Blood_symbol varchar(30), ); ...
Hamzeh Abu Rmelah's user avatar
0 votes
1 answer
58 views

When is it save to modify a SqlCommand without modifying the query to be run? For example, when I have SqlCommand cmd = getCommand(); con.executeNonQueryAsync(); //later modifyParameters(cmd); is it ...
Martijn's user avatar
  • 12.2k
-2 votes
1 answer
77 views

I have the following code which establishing an SQL connection inside of a project I am working on. What I want to do is to create a for loop which contains a method and every time the loop repeats ...
banjo's user avatar
  • 7
0 votes
1 answer
160 views

I will query four point of Minimum Bounding Rectangle covering all city in country on SQL Server. Now, I can only find POLYGON of a city in Thailand. This is my SQL command. DECLARE @TH geometry ...
atjab's user avatar
  • 146
1 vote
2 answers
1k views

How many concurrent statements does C# SqlConnection support? Let's say I am working on Windows service running 10 threads. All threads use the same SqlConnection object but different SqlCommand ...
Frank Martin's user avatar
  • 3,469
-2 votes
1 answer
60 views

[SCHOOL WORK] I have a stored procedure: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [IO].[usp_selectUser] (@username varchar(50)) AS BEGIN SELECT passwordSalt, ...
Sebastian Marjanović's user avatar
0 votes
1 answer
694 views

I have a c# winform application which connects to a database and read data. This database is used by another app also. I just executed a query from my app to read some data. I don't have the user ...
Mostafa Bagheri's user avatar
1 vote
3 answers
185 views

I need to insert data in one table and update id in second table using add button: private void addButton_Click(object sender, EventArgs e) { con.Open(); cmd = new SqlCommand("Insert Into ...
Teddy's user avatar
  • 13
0 votes
1 answer
148 views

Actually I was trying to get all columns within a date range in Oracle db and I am successful in doing so in SQL Developer but when I execute the same code in SQL command line interface I get an error ...
amjaad muhammed's user avatar
0 votes
1 answer
44 views

I have some code that inserts and updates data into a sql table. I use ExecuteScalar to check if a row already exists with the same UserName and DeviceId. If it exists, we run the update stored ...
Gabriel's user avatar
  • 386
0 votes
2 answers
2k views

I'm writing an API controller that inserts and updates records in a table. I'm able to insert new items into the database pretty easily, but I'm having a hard time understanding how to update existing ...
Gabriel's user avatar
  • 386
0 votes
0 answers
161 views

Assuming i have a stored procedure (example as follows) CREATE OR ALTER PROCEDURE test AS BEGIN SELECT * FROM sys.tables; WAITFOR DELAY '01:00' SELECT * FROM sys.tables END GO; and I ...
badazzhindu's user avatar
0 votes
2 answers
63 views

I am currently creating a win form based tool in Visual Studio 2019 that reads data from a SQL database. I am having difficulty when pulling a field from the form I am working in into the sqlCommand ...
Van Macintosh's user avatar
0 votes
1 answer
124 views

enter image description hereI am using a SQL Server Compact 3.5 database file (.sdf) in vb.net There was an error parsing the query. [Token line number,Token line offset,,Token in error,,] Dim flag ...
Anis Qabaily's user avatar
1 vote
3 answers
1k views

This interface appears every time I execute this code that you find below : str1 = "USE [" + database + "];" + vbCrLf + "GO" + vbCrLf + " CREATE TABLE [dbo].[ARMSet] ([Id] Int IDENTITY(1, 1) ...
Iheb95's user avatar
  • 13
0 votes
0 answers
3k views

Challenging issue you have encountered already ? This is my challenge. I have the query as follows - MSSQL Server 2017 calling from my C# application. SQL update slides set isBorrowed=0, ...
Daniel Wondyifraw's user avatar
0 votes
1 answer
407 views

I have an ASPX page using VB.net code, and it is set up to run a series of SQL queries and populate a SQLDataReader with the results. Each SQL query is pulled from a specific field in a table within ...
J.P. Brown's user avatar
2 votes
1 answer
245 views

this is my first question, hopefully I do things correctly. Also to preface, I'm a programming noob tasked with developing and fixing some code where I work since the programmer we've had until now ...
MasterOfNothing's user avatar
0 votes
1 answer
940 views

I am just facing a problem with my code. I want to select some data from a database using the SqlDataAdapter SelectCommand property. My code looks like: static SqlConnection sqlConnection; static ...
Mátyás Németh's user avatar
1 vote
3 answers
131 views

Hi since I am using the using-statement, my disposable connections should be handled once it leaves the statement but my code is hard coupled in other methods in the program where I poll the db or ...
Ahune ajé o ahe's user avatar
0 votes
1 answer
316 views

I would like to search in entire table, where the string is 'NA', 'na' or 'N/A'. Actually, the value was supposed to be 'n/a' but it was mistakenly placed as 'NA', 'na' or 'N/A' by different ...
mumid's user avatar
  • 17
-1 votes
1 answer
194 views

I've been googling something I dont really cant understand. In short my problem is this; When using this; String sYear2 = "2020"; string query = @"Select decJan from Stats where intRecnum = (select ...
Tomas H's user avatar
  • 75
0 votes
2 answers
988 views

I have a datatable that is created from and excel sheet. I am trying to SqlBulkCopy.WriteToServer. When I do so it converts my "Percent" value to 0 when my tables schema has type Decimal(38,0) for ...
Mwspencer's user avatar
  • 1,183
0 votes
1 answer
732 views

Hello I am trying to create a #temp table using SqlCommand.ExecuteNonQuery. When I execute the non query no error occurs, but also no table is created. If I try creating a normal table it works fine....
Mwspencer's user avatar
  • 1,183
1 vote
2 answers
1k views

I've looked at a lot of similar questions on this site and elsewhere but none of them have helped me. I'm trying to make a database connection with a query but I get the error System.Data....
211086004's user avatar

1
2
3 4 5
19