Questions tagged [selectcommand]

48 questions
1
vote
1 answer

ASP.NET: Access ListView's DataSource object programatically

I have bound my ListView to a database. I've used SqlDataSource to do the work. I want to change the datasource programatically but this is where it all goes wrong. I try to get the current datasource by doing so: SqlDataSource oldSource =…
Yulian
  • 6,262
  • 10
  • 65
  • 92
1
vote
1 answer

SELECT statement issue - Joining of data of different fields in one cell of Gridview

I am using following SELECT statement for Gridview: SelectCommand="SELECT ID, Date, Train, I_R, Dir_Ind, Detn, Rly, DiV, Loco, Shed, locoClass, loco_type, (maj_sch_type + ','+ ' ' + maj_sch_place +',' +' '+ (CAST(maj_sch_dt as VARCHAR(11)) + '…
user1185088
  • 99
  • 1
  • 1
  • 8
1
vote
4 answers

how to solve Fill: SelectCommand.Connection property has not been initialized

I have a class which I have written all my methods there. then I have my firstpage of web application which I have some codes there. I face this $exception {"Fill: SelectCommand.Connection property has not been initialized."} System.Exception…
SunnY
  • 59
  • 1
  • 4
  • 11
0
votes
1 answer

SelectCommand doesn't work when ControlParameter is not given

I have a textbox with id = txt_SearchLibrary which is also my controlparameter that I am using to filter my sqldatasource, I want to get all the results when I don't type something in my searchtext box, but below codes results 0 rows. I tried 2 way…
HOY
  • 1,067
  • 10
  • 42
  • 85
0
votes
1 answer

Error - 'SelectCommand' is not a member of the table adapter

Using this code I get an error that states 'SelectCommand' is not a member of StudentsTableAdapter. Dim cmd As New SqlCommand("SELECT * FROM Students WHERE ID=@ID", myConnection) cmd.Parameters.AddWithValue("@ID",…
Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152
0
votes
1 answer

is there any way to collect some number into grid with one column

I have a list of numbers like this : 1, 2, 3, 4 and so on. one way to make this list into grid with one column is union all. is there another way to do that? best regards
MHD
  • 25
  • 9
0
votes
2 answers

C# SqlDataAdapter - Select Command Concern

I'm having trouble with my select command. The scenario is when i'm putting many value in my variable I got nothing but if i put only one value in variable it is working. All I want is to run this script: SELECT * FROM gsm00 a INNER JOIN gsd00 b…
kaloy
  • 3
  • 1
0
votes
1 answer

Cannot change SelectCommand contents dynamically

I am having an issue trying to change SelectCommand contents dynamically. There is this Telerik searchbox control that uses SQLDataSource to constantly bang the DB with a select query and show up a list of words filtered by your typing. Then if you…
Yan Kleber
  • 407
  • 2
  • 4
  • 11
0
votes
1 answer

Strategy for selecting records for DataSet

In Most common cases, we have two tables (& more) in DB termed as master (e.g. SalesOrderHeader) & chirld (e.g. SalesOrderDetail). We can read records from DB by one Select with INNER JOIN and additional constaints WHERE for lessen volume data for…
0
votes
1 answer

How to use result of SqlDataSource query (specified in aspx file) with ButtonField?

I have specified a SelectCommand in SqlDataSource (.aspx file). This SelectCommand query will return data, that will be shown in GridView. Now there is one property named id (Primary Key) in select command, whose data will NOT be shown on GridView,…
Junaid
  • 941
  • 2
  • 14
  • 38
0
votes
1 answer

SqlDataSource InsertCommand and UpdateCommand throwing "illegal variable name/number""

I am trying to insert and update the table through SqlDataSource
Black
  • 1
  • 1
  • 1
  • 4
0
votes
1 answer

i want to restrict the user to make only select command in mysql , no delete or update or insert

MySqlConnection connection = new MySqlConnection(strConnection); MySqlCommand command = connection.CreateCommand(); MySqlDataReader reader; command.CommandText =…
0
votes
1 answer

Using a string variable in an ASPX SqlDataSource SelectCommand, is this possible?

I know that this IS possible in the codebehind, but changing the selectcommand there and binding it causes gridview issues with refreshing and sorting, so this is not an answer I'm looking for. I already incorporate parameterized statements for my…
R. StackUser
  • 2,005
  • 4
  • 17
  • 24
0
votes
2 answers

add rows from textbox in insert select command sql c#

I am creating a web app in which i am using insert into select command for which i have taken a stored procedure which looks like this alter PROCEDURE profinalinstexpensesonid ( @from varchar(5000), @to…
user6656728
0
votes
3 answers

Change SQL select command operator in WHERE part at runtime

I am trying to implement user rights management in a project with C# and asp.net. What I want to do is simply showing the relevant pages to the user according to the login name. I wrote lots of SQL select commands. Is there a way to change the WHERE…