I wanted to know is it possible to pass "SqlDataSource" data to a variable? if not how can i use datareader to do this?
i couldn't figure out how to pass SqlDataSource to a varialbe so i tried use datareader and i'm stuck in middle of it, also my query only returns one row and one column so i rather not to use array if possible. here is my code:
For context: First of all, I am new to LINQ, as I have been using SubSonic for quite some time now.
I have two tables, Users, and Affiliates. They both have a very typical schema. The FK that joins them is the UserId field, which is in the Affiliates table. I want to create a LINQ query that pulls the Username from the Users table using the AffiliateId value. The AffiliateId is a primary key of the Affiliates table.
I have tried to accomplish this using many variations of the following code:
[Code]....
In the above query, I expect to get a single row result set. However, I instead receive the entire table of results.
How can I make this work? I have yet to see an example or article out there to do what I am trying to do.
I have 3 tables in single database with different strctures,3 tables have unique column(partno or Jobno) , on web form search button input control(textbox) and grid view.I am pulling the data based on column jobno from single table on to grid view using following code
Table1 - user master table. table2 - transaction table. Now I want to write a single query which will give results like table 3. how to write single query.
I have 2 tables. Table_A has one to many relationship with Table_B.
For example. Table_A has an ApplicantKey and in Table_B I am storing (Resume_name and CoverLetter_name for the Applicant). Joined by ApplicantKey
Now when I join them and execute the query obviously it returns me two rows. But what I want is that it should return only one row with Columns like Resume_name, CoverLetter_Name
i develop a c# windows application. My database is sql server 2008 exp. i want lock single row for user select it for update. for example;
userA - Connection a (connection id 52);
user select a single row (select * from t1 with(rowlock?, updlock?,or what) where id=1) and bind data to form fields (texbox, checkbox,combobox etc.). (there is no problem)
userB - Connection b (connection id 54);
userB can select all other rows from t1 (where id=2 or 3 or anything) but not id=1. when userB select * from t1 where id=1 system generate an exception with (you cannot select this row because it is updated. Updated users connection id is 52.)
when userA (connectionid52) close form or commit changes then userB can select id=1.
i am read few documents (transacions, rowlock,updlock, concurrency violation optimistic,pessimistic) but i couldn't understand.
I've managed to connect to the database and return a record based upon a login name. I can itterate through the rows printing out the password but I know there's only 1 row (or can test for that) so how do I get the value of the password for the one row without the loop?
Dim supervisorAdapter As New SupervisorTableAdapters.SupervisorTableAdapter Dim supervisors As Supervisor.SupervisorDataTable supervisors = supervisorAdapter.GetSupervisorByLogin(login) For Each count As Supervisor.SupervisorRow In supervisors Response.Write(count.password) Next
I'm working on my private website(using VS2008) which is connected to a simple database(using SQL management studio 2008). The database is currently located in the App_Data folder and the connectionstring should be quite simple;
[Code]....
After reading several forum threads I have changed the following;- Permission (locating the db and going into security, removing current users and adding me (local) to it as single owner on both .mdf and log file.
This works great for 1 parameter SqlDataSource1.SelectParameters("City").DefaultValue = Me.Page.Title
But I can't figure out how to pass in two parameters in a single statement (See the Select Parameters Below) Two paremeters (City, and Classification) If I set the page title to say "Bismark Charters" Bismark = City & Charters = Classification [Code]... </SelectParameters >
SQLCommand cmd = new SQLCommand("insert into customers name values ('"+textbox1.Text+"')",conectionstring); cmd.ExecuteNonQuery();
now when people enter a (') single quote, this doesnt work. how do i avoid this error as this is driving me nuts!! i cannot prevent users from entering single quotes as names like "O'Connor" contain a single quote. parameterized query doesnt seem to be the best solution as it involves loads of coding and will involve huge changes in the code. as its not a fresh app im making... can some modification in the code above so this can be avoided?
I want to achieve that when a user click on the subject to open the email, then i want to update the database. I want to update the database on the click of the subject only.
I'm attempting to hook up multiple DropDownLists to a single SQLDataSource, but I want the SQLDataSource to return different rows depending on which DropDownList it is populating.
Say I have a table full of names (we'll call it TABLE_NAMES):
[code]....
....and I have two dropdown lists, one with a list of person names and one with a list of dog names.
Is there a way to link up each of these dropdown lists to a single SQLDataSource and use the SelectParameter to differentiate between which records I want returned for each dropdown list?
To make matters worse, these dropdown lists will appear within a GridView control....so there will be multiple instances of each dropdown list depending on how many rows there are in the GridView.
as you can see I'm a table adapter but is giving me the following error: i realy dont know what this error means - though i did a simular action using access DB (and it did work), where i had to user the following: using System.Data.OleDb; now because im using SQL DB im using: using System.Data.SqlClient; //sql server
tbl_events: -Event_ID int -Event_Name varchar -Event_Organiser varchar tbl_events_organisers -Organiser_ID int -Organiser_name varchar
In event_organiser of tbl_events i want to store the organiser_ID's of the second table in an array, so a record in the first table will like something like:
-Event_ID=18 -Event_Name=My event name -Event_Organiser= 15,31,109,21
I am running the code below to read a sql table and populate the values into a list. This works on the first run through, but after the data has been processed, and the process then re runs, if the sql table has been modified externally, the read of the records does not change. I imagine it is being cached somwhere but as I re dim the dData variable, shouldn't it all be dropped and run afresh?