|
In VB.NET, the data of a grid is associated with a table("tblUser"),
tblUser, and tblUserPrivilege are relational tables, while I modify the data of the grid, it'll throw an SqlException because of the relation,
my question is:
how can i update these two tables?
...waiting for some solutions, ...
|
|
|
|
|
I have installed MSDE2000 and how can i see as server in SQ Server Enterprise Manager also how can i view Databases in this server.
|
|
|
|
|
Search for SqlBuddy in google
|
|
|
|
|
|
|
hi
It seems that my code can insert data into memory, but not into the database. What I mean is that after "insert data", I can "read data",
which I just insert. When I check the actual database table, it didn't
get updated.
I am using VS 2005 and table designer. Regarding to this problem, is
it related to any setting of setup of the database? I check the code,
and I have no idea how it occurs.
private static string connectionString = null;
private static SqlConnection connection = null;
private static string commandString = null;
private static SqlCommand command = null;
private static SqlDataReader reader = null;
static void Main(string[] args)
{
connectionString = ConfigurationManager
.ConnectionStrings["appDatabase.Properties.Settings.databaseConnectio nString"]
.ConnectionString;
connection = new SqlConnection(connectionString);
try
{
// Insert data
commandString = @"INSERT INTO userTable
(userID, permissionLevel, mobile, emailAddress, mailAddress, pager) VALUES(1, 2, '123', 'aa@a.com', 'oz', 'no')";
SqlCommand command = new SqlCommand(commandString, connection);
connection.Open();
command.ExecuteNonQuery();
connection.Close();
// Read data
commandString = @"select * from userTable";
command = new SqlCommand(commandString, connection);
connection.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["permissionLevel"].ToString());
}
connection.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
regards
figo2476
|
|
|
|
|
The only thing I can think of - if you're sure that you're looking at the right database - is that you've got the implicit transactions option turned on. This automatically creates a transaction when you first execute a data modification statement (INSERT, UPDATE, DELETE). If you don't execute a COMMIT TRANSACTION statement, it'll be rolled back when the connection gets closed. Also, other connections won't see the modification due to transaction isolation, unless they use the READ UNCOMMITTED level or NOLOCK hint (not recommended). The SELECT statement in your code can see it, I conjecture, because the connections are pooled - when you call connection.Open() the second time, you're getting the same underlying connection back from the pool, which hasn't actually been closed in the meantime, so the transaction is still open.
I wouldn't recommend using the implicit transactions option.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hai,
Iam new to sequel server and any database related projects.
now i need to work on sequel server . plz guide me where do i get online help for sequel server and what r the books to prefer?
please guide me regading this.
krishna
|
|
|
|
|
internet: www.sqlservercentral.com or the Book online installed with the sql server
|
|
|
|
|
|
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[^]
|
|
|
|
|