Questions tagged [command-text]

ADO CommandText Property

The CommandText property sets or returns a string that contains a provider command, like a SQL statement, a table name, a relative URL, or a stored procedure call.

More...

10 questions
1
vote
1 answer

Can't get PS SQL insert to work. Multiple "ExecuteNonQuery" errors

I have below PS that grabs data from AD and puts it in a CSV file. Then it should insert the data to the SQL server and overwrite existing data. For some reason I just can't get this to work. Spent the last 5 hours searching here and other places…
Noseydgj
  • 11
  • 1
1
vote
2 answers

How to use string_agg in SQL in Excel Query

I know that in SQL I can use the 'String_agg(Test1, ',')' function for grouping rows and concatenate values in a selected field ('Test1' in this case). For Example: I have a query that the result without using String_agg on 'Buyer' field is: **Key**…
Gilad K
  • 17
  • 5
0
votes
0 answers

Excel VBA OLEDBConnection.CommandText doesn't work with LIKE operator

I need your help to match my fallacy (or just stupidity) by creating a simple SQL Query string in Excel VBA. Connection 3 is a Microsoft SQL database on a separate server. If I use the operator "=" the code work, when using "LIKE" instead runtime…
0
votes
1 answer

Return scalar value from parameterized SQL statement using DB2 EF Core

In a class library targeting .NET 5.0, EntityFramework Core, I can use the following code to return a scalar value from parameterized SQL statement using EF Core for SQL Server: public object GetResult() { var context =…
0
votes
1 answer

SQL Unable to Insert Converted DateTime in Column

I am puzzled why I am unable to insert a converted date value into my table column when the output of it is the same. Error: An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll Additional information:…
gymcode
  • 4,431
  • 15
  • 72
  • 128
0
votes
2 answers

SQL cmd.command include an OR statement

Below is my SQL cmd.CommandText query: cmd.CommandText = "SELECT CONVERT(date, [DateTime]) 'Date of Download', ActionBy AS 'User Full Name', COUNT(DISTINCT CAST(Identifier AS NVARCHAR(10)) + Remarks + Link) 'Number of Document Downloads' " + "…
gymcode
  • 4,431
  • 15
  • 72
  • 128
0
votes
1 answer

Is there a workaround for the maximum length of an ODBCConnection.CommandText string in VBA?

I have a VBA script that generates a query string for a SAP HANA ODBC Connection in Excel. The query is determined by user inputs and can vary greatly in length. The query itself uses many versions of a similar query appended to one another using…
jackelsey
  • 169
  • 1
  • 5
  • 17
0
votes
1 answer

Wrong number of arguments or invalid property assignment: 'CommandText'

I have the following code in a Classic ASP website that I have to update the SQL statements and for some reason I keep getting the error Wrong number of argument or invalid property assignment 'Command Text. I have tried changing the…
user8053788
-1
votes
1 answer

'ExecuteNonQuery: CommandText property has not been initialized' beginner here

im new with sql and c# and im having an error in executenonquery commandtex. i dont know where the error is. can you guys help me out here? private void submitBtn_Click(object sender, EventArgs e) { con.Open(); string a = "Accept"; …
-1
votes
2 answers

SQL Limit clause - vb.net

I've been trying to find a solution to my query regarding the LIMIT Clause, here's my code, "SELECT * FROM tbl_student WHERE s_grade='" & grade.Text & "' AND s_status='Validated' ORDER BY s_id_no ASC LIMIT 10" I was wondering if could do, …
Leo Elvin Lee
  • 189
  • 1
  • 6
  • 16