DataSource Controls :: Multi-part Identifier "t.fk1" Could Not Be Bound?
May 18, 2010
there is a statement like " select t.f1, (select ta.f2 from ta where t.fk1=ta.fk1) from t inner join ta on t.fk1=ta.fk1 "? In SQL 2005, this will get the message "The multi-part identifier "t.fk1" could not be bound.".beacuse the result will contains duplicate data from table ta in one row.
I have written a SP which checks if a table(variable) exists,And removes the table if it exists,
SET NOCOUNT ON; DECLARE @SQLQUERY varchar(1000) SET @SQLQUERY='IF EXISTS (SELECT * FROM dbo.sysobjects where id = object_id(dbo.' + @tableName + ')) drop table [dbo].' + @tableName exec(@SQLQUERY)
I found a lot of stuff on this topic but nothing that matches my problem.I'm coding a simple search function and came up with this code:
Dimsql As String = "SELECT DMS_files.id, DMS_files.descriptionSV, DMS_files.description, DMS_MainCategories.categoryNameFI AS 'main', DMS_SubCategories.categoryNameFI AS 'sub' FROM [DMS_files] INNER JOIN DMS_MainCategories ON DMS_files.cid=DMS_MainCategories.id INNER JOIN DMS_SubCategories ON DMS_files.scid=DMS_SubCategories.id WHERE (DMS_files.descriptionSV LIKE '%" & str & "%' OR DMS_files.description LIKE '%" & str & "%')" If (User.Identity.IsAuthenticated = False) Then sql = sql &" AND DMS_MainCategories.allowPublicSearch = 1" End If
With this I get the error "Multi-part identifier 'DMS_MainCategories.allowPublicSearch' could not be bound". But if I put the line straight to the first string, like below, it works.
Dim sql As String = "SELECT DMS_files.id, DMS_files.descriptionSV, DMS_files.description, DMS_MainCategories.categoryNameFI AS 'main', DMS_SubCategories.categoryNameFI AS 'sub' FROM [DMS_files] INNER JOIN DMS_MainCategories ON DMS_files.cid=DMS_MainCategories.id INNER JOIN DMS_SubCategories ON DMS_files.scid=DMS_SubCategories.id WHERE (DMS_files.descriptionSV LIKE '%" & str & "%' OR DMS_files.description LIKE '%" & str & "%') AND DMS_MainCategories.allowPublicSearch = 1"
select good.fromwho , good.applesdate, good.starttime , good.hungupfromwho from apples good where ( good.type = 1 and good.result = 2 and good.fromwho not inselect bad.towho from apples bad where bad.type = 2 and bad.result = 1 and bad.applesdate >= good.applesdate and bad.starttime > good.starttime )
What I want to be able to do is add to my top selection statement columns from the "bad" table. If I try, it gives me
The multi-part identifier "bad.towho" could not be bound.
I am just wondering how do I get the very last row of a join statement if I don't have any unique identifier... as in row_number field?Is there a way of creating a dummy column on my SQL statement to hold the record numbers of all records ..[1 to n] etc ???Id like to know how to do this and then I can get the MAX record number.Im using SQL server 2005 so the last() function doesn't work.
I'm using Visual Web Developer Express 2008 and SQL Management Studio Express 2005. I need to link 2 tables to either present in a Master/Detail or GridView/Form view.The goal is to allow the user to view time card information from the AS400 (read only) and then enter any corrections into a SQL table. My problem is in trying to connect the two tables.I've asked the AS400 administrator to add a unique identifier field to the table (HAPOINT), but he says he can't. I've tried to concatenate a field within Visual Web Developer's Query Builder but keep getting errors.Table 1 - exists in AS400, is non-permanent (cleared every 3 months) and can't be modifiedEmpl ID WO Date In Time In Date Out Time Out Table 2 - exists in SQL Server, newly created for this project (no data yet, so can be modified)Rev ID Empl ID Date (of revision entry) X (Revise - y/n) Revised Time In Revised Time Out I tried finding a solution through the SQL Forum, but haven't gotten a solution, so I'm posting here. There are additional details at that post:http://forums.asp.net/p/1516929/3658517.aspx#3658517Can anyone tell me how to concatenate "Empl ID /WO / Date In / Time In" from Table 1 to produce a unique identifier that I can then use in Table 2, thus providing the link between the two tables? Or, is there another way?
I would like to create a multi-part form that can be used for entering and updating data.
From all of the tutorials it was unclear to me how to read the value of, for example, the text in a text box, so that I can update a database. One of the videos deals with using find control to find the values of controls that are inside item templates. That doesn't seem to be applicable here.
The second question I have is how to populate the value of a textbox or dropdown list from a database.
I am a newbie on the subject. Seems I am missing something.
I have viewed and tried the samples in this site and tried to modify the moviesDB example with adding 2 more tables to my database. Tried to use other tables with different pages but didnt work. When I try to go to the page i created it redirects me to the index.aspx again and again. When I try to enter the direct adress to the explorer then I get an error. Is there any multi-paged and multi-tabled(sql i mean) example around? for the ppl who need to start from the begining....
I have a .NET 4.0 console application that does a lot of reads from SQL Server 2008 using the OleDbDataAdapter object.I tried to improve performance by spreading the processing logic across four threads using Visual Studio 2010's Task Parallel Library. Sadly the multi-threaded version is three times slower than the original. Using VS2010's performance tools, I found thousands of thread contentions caused by the method OleDbDataAdapter.Fill() which populates a DataSet.This is puzzling as there are no static classes or variables involved that would result in the OleDbDataAdapter being shared by my threads. Also, four simultaneous connections just can't cause a hold up at the database level, right? The default connection pool size should be much larger than this.
Our current application is working fine but when you try to misbehave like we found out that When login with same user in multiple tab with different organization(there is a organization dropdown in the master page which sets the cookie whenever it is changed.) in tab one it is org 1 and tab 2 it is org2 , cookie has the later org 2 in it but when we go back in tab1(which had org1) and save the record org 2 will be saved with the record So can some one share some sort of a checklist with us which address these types of problem.
I have the following code that I wasnt to alter the Dataset before it is bound to the dropdown list.
[Code]....
What I would like to do is ALTER the dataset for the Parent (dropdown list - ddlRT). I need to format and disable certain topics. I have a script I create before I added the datarelations.
I have a sqlDataSource to populate a grdiview ( simple ) . When I set the sql control to a stored proc that has 4 parameters and person a select * from table ignoring the paramaters it doesn't work. No rweturned results.
how one would retrive a value stored among several values in a single database field?
For example, the MS Customize CreateUserWizard walkthrough [URL] adds the ability to save the users preference for subscribing to a newsletter and allowing their info to be shared as 1 value in the comment column of the membership database. The result ofaspnet_Membership.Comment is Subscribe=TRUE&ShareInfo=FALSE.
My question is if Subscribe=TRUE&ShareInfo=FALSE is in one field of the database, how would you retrieve just the Subscribe=TRUE value from the field and use it to send a newsletter to the proper users while ignoring the ShareInfo=FALSE value?
I'm trying to create multi insert query in single stored procedure along with scope_identity variable. while execute the aspx page getting error "Procedure 'sp_seller_ins' expects parameter'@new1', which was not supplied." I have created stored procedure:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_seller_ins] @txt_n_properity VARCHAR(50), @txt_t_properity VARCHAR(50), @txt_prop_for VARCHAR(50), @txt_flat_no VARCHAR(50), @txt_loc_country VARCHAR(50), @txt_loc_state VARCHAR(50), @txt_loc_district VARCHAR(50), @txt_loc_town VARCHAR(50), @txt_loc_area VARCHAR(50), @txt_loc_locality VARCHAR(50) AS BEGIN declare @new1 int declare @new2 int INSERT INTO dbo.sel_pro_details( nature_property, type_property, property_for, flat_no) VALUES ( @txt_n_properity, @txt_t_properity, @txt_prop_for, @txt_flat_no); set @new1 = scope_identity() INSERT INTO dbo.sel_loc_details( country, state, district, town, area, locality, pro_details_id) VALUES (@txt_loc_country, @txt_loc_state, @txt_loc_district, @txt_loc_town, @txt_loc_area, @txt_loc_locality, @new1); set @new2 = scope_identity() end code behind aspx page sqlconn mySql = new sqlconn(); mySql.CreateConn(); mySql.Command = mySql.Connection.CreateCommand(); mySql.Command.CommandType = System.Data.CommandType.StoredProcedure; mySql.Command.CommandText = "sp_seller_ins"; mySql.Command.Parameters.Add("@txt_n_properity", SqlDbType.VarChar); mySql.Command.Parameters["@txt_n_properity"].Value = txt_n_properity.Text; mySql.Command.Parameters.Add("@txt_t_properity", SqlDbType.VarChar); mySql.Command.Parameters["@txt_t_properity"].Value = txt_t_properity.Text; mySql.Command.Parameters.Add("@txt_prop_for", SqlDbType.VarChar); mySql.Command.Parameters["@txt_prop_for"].Value = txt_prop_for.Text; mySql.Command.Parameters.Add("@txt_flat_no", SqlDbType.VarChar); mySql.Command.Parameters["@txt_flat_no"].Value = txt_flat_no.Text; mySql.Command.Parameters.Add("@txt_loc_country", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_country"].Value = txt_loc_country.Text; mySql.Command.Parameters.Add("@txt_loc_state", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_state"].Value = txt_loc_state.Text; mySql.Command.Parameters.Add("@txt_loc_district", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_district"].Value = txt_loc_district.Text; mySql.Command.Parameters.Add("@txt_loc_town", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_town"].Value =txt_loc_town.Text; mySql.Command.Parameters.Add("@txt_loc_area", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_area"].Value =txt_loc_area.Text; mySql.Command.Parameters.Add("@txt_loc_locality", SqlDbType.VarChar); mySql.Command.Parameters["@txt_loc_locality"].Value =txt_loc_locality.Text; mySql.Command.ExecuteNonQuery(); mySql.Command.Dispose(); mySql.Connection.Close(); mySql.CloseConn();
I am inserting mortgage loan scenarios in via GridView table. Let's say $100K loan with FICO score 700 in state of MN.
Sometimes I want to apply the same scenario to multiple states rather than Inserting one row at a time. I figured a Listbox with SelectionMode="Multiple" option would be to way to go.
How do I bound a Label to a datasource and its field?I got set up the datasource to a gridview, but don't know how to bind a label to the same datasource.
I have a GridView populated by an ObjectDataSource. I also have several DropDownLists filtering the ObjectDataSource. I found a link providing a way to export a DataSet (or DataTable) to Excel here:
ow I can ensure that filters applied to the ObjectDataSource when the method is called are applied. In short, how can I ensure what the UI is displaying is what the file will include when exported?
I'm trying (poorly I might add) to set up a select statement and due to my noobishness I simply have not found a way to do it RIGHT. Then again - I'm probably starting entirely wrong - but I've gotta' learn somewhere.I'm attempting to track product usage (think mild inventory tracking). In the system, I have independent parts and builds (combination of independent parts) - each has its own SQL table. Each time a "build" is completed, I want to update my part inventory with an updated count of that item.
I am having with the a full text index I am developing for a product catalog. It does all work to a degree I am just seeing some strange things happening.
From the database side I have a Products table that is being indexed on both the PartNumber and Description columns because I would like the users to be able to search either or using the search function.
Problem 1:
whenever I use multiple words in the search I don't always get the results I am looking for, this happens most notably when I am attempting to say put in a full part number (which for in this case would look like "I 10-9.2")
Problem 2:
I am not 100% sure that this is the most efficient way of completing what I am attempting to accomplish here since I have 2 columns that I need to perform the search on
Here is an excerpt from the click even when the user clicks the search button on the page:
[Code]....
And here is the search functions called from the click event to firstly check if there are any results and the second to display the results in a custom gridview:
I have a FormView bound to LinqDataSource, that is intended to allow editing of a single product's details, that is selected from a GridView. The LDS has a Where parameter set to point to the GridView control (i.e. a ControlParameter).
This was a pretty disappointing moment - when databinding, using Eval("Contact.LastName") would work. It nicely evaluates the related Linq object's member LastName. If the "Contact" object is null, no error is thrown... instead the field is simply null.
However, the same does not hold for sorting - if there exists a null entry (this object does not have a Contact) then the LinqDataSource throws a NullReferenceException. This means that, if you ever have nulls on your foreign-key objects, you can't use sorting headers in the ListView.
This makes the feature moderately useless - I have to roll my own properties for every single field I'd ever want to sort on. That's insane.
I am trying to create a multi column listbox by combining fields in Linq select statement, as Let Name = Last + First. The problem is how to pad the Last column with spaces as you would in SQL using REPLICATE so when I bind the listbox to the data, it looks like two columns.