[Solved] Trouble writing a select query [closed]

[ad_1] It looks like vb code if you want c# code then use following code cmd = new SqlCommand(“select name from wq where id='” + TextBox1.Text + “‘”, con); con.Open(); dr = cmd.ExecuteReader(); dr.Read(); TextBox2.Text = dr[0].ToString(); dr.Close(); con.Close(); 7 [ad_2] solved Trouble writing a select query [closed]

[Solved] If I have two columns, how can I select all distinct values of columnA where columnB is never a specific value given that columnA is the same value?

[ad_1] If I have two columns, how can I select all distinct values of columnA where columnB is never a specific value given that columnA is the same value? [ad_2] solved If I have two columns, how can I select all distinct values of columnA where columnB is never a specific value given that columnA … Read more

[Solved] Locate coordinate from angle from n nautical miles

[ad_1] //Example with mutliple coordinates before creating an arc. AREA DEFINED AS 133830N1450807E TO 132836N1444449E TO 133043N1443814E TO 133515N1443710E THEN CLOCKWISE ON A 15.3 NM ARC CENTERED ON 133416N1445256E TO THE POINT OF ORIGIN //Abbreviation // a // b // m(midangle) (cx,cy,ax,ay,bx,by) // x(lat) // y(long) //Xc=latitude provided in text for center point //Yc=longitude provided … Read more

[Solved] C# DateTime not working for MSSQL stored procedure [closed]

[ad_1] Lets work backwards here – your stored proc will never work, you have not specified a field for the where, and it has 2 missing close parentheses. select * from MyTable where between CAST(@startDate AS VARCHAR(100) and CAST(@EndDateAS VARCHAR(100) should be select * from MyTable where SOMEFIELD between CAST(@startDate AS VARCHAR(100)) and CAST(@EndDateAS VARCHAR(100)) … Read more

[Solved] Delete query to delete data from multiple tables in sql server and c#

[ad_1] Like this? It seems easiest just to do it as three separate statements. DELETE FROM Products WHERE SubCatId IN (SELECT SubCatID FROM SubCategory WHERE MainCatId = @mainCatId); DELETE FROM SubCategory WHERE MainCatId = @mainCatId; DELETE FROM MainCategory WHERE MainCatId = @mainCatId; 8 [ad_2] solved Delete query to delete data from multiple tables in sql … Read more

[Solved] XML generation using c#

[ad_1] Try following xml linq. I put your input file into a text file and then read into DataTable. Then create XML from table : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; using System.Data; using System.IO; namespace ConsoleApplication1 { class Program { const string INPUT_FILENAME = @”c:\temp\test.txt”; const string OUTPUT_FILENAME … Read more

[Solved] SQL query for display one field only once which having multiple record

[ad_1] Using CASE Condition and Row_number we can achieve the above Output It’s Purely based on your sample Data DECLARE @Table1 TABLE (projName varchar(1), percentage int) ; INSERT INTO @Table1 (projName, percentage) VALUES (‘A’, 10), (‘A’, 25), (‘B’, 20), (‘B’, 30) ; Select CASE WHEN RN = 1 THEN projName ELSE NULL END projName, percentage … Read more

[Solved] I have a code for a stored procedure to create a table .But it returns error message while executing.Can any one please help me to solve this? [closed]

[ad_1] At least immediately, I notice you are missing the end: create procedure new_SP ( @tablename varchar(50) ) as begin declare @xxx varchar(50) set @xxx= ‘create table ‘+@tablename+'( name varchar (50))’ print @xxx exec (@xxx) end — you are missing this If you add the END, then this should work. Just tested it in SQL … Read more