|
Hi
How to get value from some for example dropdownlist control who is insert into gridview control.I need that for update commanand.Pleas help me,
good bye and hava a nice day.
|
|
|
|
|
You have to be more specific in your request and is this really a SQL db problem ?
|
|
|
|
|
Hey guys,
I have four tables UniversityDB(main Table), UniSourceDB, UniMajorDB, CDDB.
All four tables have the field "UniCode" in common, I want to select fields from four tables
I used this comand >>>
string cmd = "SELECT UniversityDB.UniID, UniversityDB.UniCode, UniversityDB.UniName, <br />
UniversityDB.UniCity, UniversityDB.UniState, UniversityDB.UniAddress, <br />
UniversityDB.UniDetail, UniMajorDB.Major, UniMajorDB.Level, UniSourceDB.SourceName, UniSourceDB.Year, CDDB.CDNumber, CDDB.Year FROM UniversityDB, UniMajorDB, UniSourceDB, CDDB where UniversityDB.UniCode = '" + UniCode_tb.Text + "' and UniversityDB.UniCode = UniMajorDB.UniCode and UniversityDB.UniCode = UniSourceDB.UniCode and UniversityDB.UniCode = CDDB.UniCode";
The problem is that if one of UniSourceDB, UniMajorDB, CDDB don't have any value that match
UniCode_tb.Text, then it wouldn't be shown ?
Can you please help me out and give me a better select command so i don't have this problem.
Thanx
Mr.K
|
|
|
|
|
Here is one possible solution:
string cmd = "SELECT UniversityDB.UniID, UniversityDB.UniCode, UniversityDB.UniName,<br />
UniversityDB.UniCity, UniversityDB.UniState, UniversityDB.UniAddress,<br />
UniversityDB.UniDetail, UniMajorDB.Major, UniMajorDB.Level, UniSourceDB.SourceName, UniSourceDB.Year, CDDB.CDNumber, CDDB.Year FROM UniversityDB LEFT JOIN UniMajorDB ON UniversityDB.UniCode=UniMajorDB.UniCode LEFT JOIN UniSourceDB ON UniversityDB.UniCode=UniSourceDB.UniCode LEFT JOIN CDDB ON UniversityDB.UniCode=CDDB.UniCode WHERE UniversityDB.UniCode = '" + UniCode_tb.Text + "'";
This assumes that the UniversityDB table will always have a record.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
SELECT DB.UniID,
DB.UniCode,
DB.UniName,
DB.UniCity,
DB.UniState,
DB.UniAddress,
DB.UniDetail,
MDB.Major,
MDB.Level,
SDB.SourceName,
SDB.Year,
CDDB.CDNumber,
CDDB.Year
FROM UniversityDB DB
LEFT JOIN UniMajorDB MDB
ON MDB.UniCode = DB.UniCode
LEFT JOIN UniSourceDB SDB
ON SDB.UniCode = DB.UniCode
LEFT JOIN CDDB
ON CDDB.UniCode = DB.UniCode
WHERE DB.UniCode = '" + UniCode_tb.Text + "'
|
|
|
|
|
Thanx guys
|
|
|
|
|
hi
i am not able to deploy my asp.net app on iis ,it says login failed for sameer\aspnet,pls help,i not able to make hw to add it
sameer
|
|
|
|
|
The particulars: I have a 2.0 ASP/C# app, making use of Sql Server 2000 on the back end. There are 3 actual machines in play here:
1. DB server - windows 2003, Sql Server 2000
2. Web server - windows 2003
3. My own work station - windows 2003
The app works fine on my computer (which doubles as a testing machine), interacting with the database on the DB Server. When I upload it to the webservcer, however, problems arise.
It's a simple app, and everything works except one specific thing in the admin section: editing information (it's a membership directory for a client). You can add and delete no problem; additionally both the searches in the admin section as well as the public search functionality work no problem. Detail viewing (see below) works no problem. The page itself has a simple searching mechanism, a gridview to display results of a search (including partial matches), and then a details view (dvMember) for the specifics of a result. dvMember is bound to a datasource, dsMember. dsMember has Select and Update commands - both stored procs. dvMember is a mishmash of boundfields and templatefields currently. It relies on dsMember for switching between edit/viewing mode.
When I try to edit a member on the production server, I get the following error message:
"@original_MemberID is not a parameter for procedure spEditMember. "
Well, that's correct. There is no such paramater for spEditMember. Furthermore, there's no such data anywhere inside the control or on the page. spViewMember is the select command, and it pulls no such thing out of the database. I have no idea where this is coming from. There is a MemberId paramater, it's the PK for tblMember int he database. Again, the proc itself lacks the referenced parameter in the error message. Again, this works on my machine. But when I move it to the production server, nada. I'm not sure where to look for the cause of the problem. I haven't found anything crazy on the .aspx page or in the codebehind. Is it some difference between how things are set up on the live server and how they're set up on mine?
|
|
|
|
|
Hi
My question is when i have it some datagrid and in this data grid i have dropdownlist how to get selected value of dropdownlist and to put in update command?
best regards
|
|
|
|
|
Hi
Is there any way within T-SQL to access another database
for example if i was writing a stored procedure to access some records in Northwind, but also wanted to update a table
in Pubs
Is this possible ??
i wanted to do something like
Select @rec = recVal from [dbo.northwind].Sometable
update [dbo.pubs].Sometable
set myvalue = @rec
thanks
sI
|
|
|
|
|
si_69 wrote: Select @rec = recVal from [dbo.northwind].Sometable
update [dbo.pubs].Sometable
try this:
<br />
Select @rec = recVal from northwind..Sometable<br />
<br />
update pubs..Sometable
you can't forget something you never knew...
|
|
|
|
|
Quick Guide.
From different database db.owner.table
eg SELECT * from northwind.dbo.Customers
From another box
SELECT * from server.db.owner.table
eg SQLserver.NorthWind.dbo.Customers
|
|
|
|
|
Hi..
I am trying to make a full text search through all indexes(tables) in a full text catalog.So i wrote the code:
CREATE PROCEDURE SearchProject
(
@SearchString varchar(500)
)
AS
SELECT FT.Rank,PL.ProjectNO,ProjectImage,FieldNO,PL.ProjectName,PL.ProjectDescription,PL.CultureID
FROM FREETEXTTABLE(Project_Locale,*,@SearchString) AS FT JOIN Project_Locale AS PL JOIN FREETEXTTABLE(ProjectField_Locale,*,@SearchString) AS FT2
JOIN FREETEXTTABLE(Feature_Locale,*,@SearchString) AS FT3 JOIN
ProjectFeature AS PFEA JOIN Project AS P
ON FT.[KEY]=PL.ProjectCultureID
OR FT2.[KEY]=P.FieldNO OR FT3.[KEY]=PFEA.FeatureNO
RETURN
but i got the error :
incorrect syntax near the word 'RETURN'
How could i solve this problem? and Could this code make the search as i wanted?
-- modified at 10:15 Tuesday 11th April, 2006
|
|
|
|
|
Hi,
Can anyone tell me the diff. betn. nvarchar & varchar , and int & number datatypes in SQL 2000 Server database.
Also I want to change the length of the data field of int datatype from 8 to 10, but I'm not able to change it.
Thanx & Regards.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
The difference in varchar and nvarchar datatypes is simple. Nvarchar stores UNICODE data. If you have requirements to store UNICODE or multilingual data, nvarchar is your choice. Varchar stores ASCII data and should be your data type of choice for normal use.
UNICODE requires 2 bytes for each character you store. ASCII only requires 1 byte for each character. This is important because of the row size limitations of Sql Server is the same as the page size limit, which is 8060 bytes. This means a single row of a single varchar column can be varchar(8000), but a single row of a single nvarchar column can only be nvarchar (4000).
check this link
http://www.aspfaq.com/show.asp?id=2214[^]
|
|
|
|
|
Length of int type is fixed.
|
|
|
|
|
Vikrant Badhai wrote: Also I want to change the length of the data field of int datatype from 8 to 10, but I'm not able to change it.
An int is a 32bit integer. Range -2billion to +2billion (roughly). If you want anything larger then use a bigint
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Mixing nvarchar and varchar on the same table / view can produce some strange results with matching strings in TSQL as the length is different in the database. If your only using your db locally use varchar if you have international client / users and want to use multiple languages use nvarchar.
|
|
|
|
|
Hey guys.
Got a little question I could use some help.
Suppose I have a table with 2 fields : Date and Ammount.
I need to write a query that displays each date and the sum of ammounts to that date.
I got a bit messed up with it...
Isaac
|
|
|
|
|
You could try joining the table onto itself
SELECT d.[Date], SUM(a.Amount)
FROM MyTable AS d
INNER JOIN MyTable AS a ON a.[Date] <= d.[Date]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Well you forgot the GROUP BY d.[Date] but it's genious none the less!
Thanks a lot!
Isaac
|
|
|
|
|
Well, I guess that happens from time to time when I type directly into Code Project rather than conduct a test first. Which is a good thing to learn: Always test code before releasing it.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
im not the best with SQL statements and have quite a tricky one to work out. If anyone could help me out id be extremely grateful.
I have a database of orders placed by customers, which need to be returned and counted in groups so for example the customer has ordered the following:
Car Tyre @ £50
Car Tyre @ £50
Car Door @ £25
Car Ariel @ £5
Car Tyre @ £50
So i need to return this information grouped as such:
3 * Car Tyre @ £150
1 * Car Door @ £25
1 * Car Ariel @ £5
it would also be useful to have a statement which gives me the same detail but with the price of a single item eg:
3 * Car Tyre @ £50
1 * Car Door @ £25
1 * Car Ariel @ £5
Thanks in advance!
munklefish
|
|
|
|
|
Try something like this:
SELECT COUNT(*) AS Quantity,
CarPart,
CarPartPrice,
SUM(CarPartPrice) AS CarPartTotalPrice
FROM Orders O
JOIN Customers C
ON C.CustomerID = O.CustomerID
WHERE C.CustomerID = 1
GROUP BY CarPart,
CarPartPrice
WITH ROLLUP
|
|
|
|
|
|