|
Be a bit more elaborate about your question...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
hi,
in my app , i expect; when user write Record Number a textbox then click delete button i want to be deleted that record.
Code ;
OleDbCommand delCmd = new OleDbCommand("DELETE FROM FAALIYET WHERE KNO =" + txtKayitNo, Rapor);
Rapor.Open();
delCmd.ExecuteNonQuery();
Getting Error ; 'KNO =System.Windows.Forms.TextBox, Text: 6' syntax error in the query.
whats the problem?
|
|
|
|
|
try changing code to:
OleDbCommand delCmd = new OleDbCommand("DELETE FROM FAALIYET WHERE KNO =" + txtKayitNo.Text, Rapor);
it's much better and safer to use parameterized queries.
|
|
|
|
|
lol this is so funny mistake i forget put .text in front of the txtKayitNo. Thanx mann
|
|
|
|
|
hello,
i've a question that is there any way by which i can store a string direct to database instead of table ? something like settings in C#
because i dont want to make a table only for that string
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
A database is made up of tables. That's how it works. You need to define a table to have a place to store your data. Perhaps the DB is the wrong place for what you want to store, or you need to define a table of key/value pairs to let you store unique values ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
nono, i just want to store a string with every database, something like a tag property with every control in C#
it will be strange that if someone make a table only for a string
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen wrote: it will be strange that if someone make a table only for a string
Maybe, but this is the right way
|
|
|
|
|
Extended properties can be used for storing metadata. As people have said though - if this information is part of your domain it should be in the model - even if it is Config ( Key, Value)
|
|
|
|
|
Config ( Key, Value) ?????
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
as in make a TABLE Config ( PK Key NVARCHAR(), Value NVARCHAR() )
|
|
|
|
|
so you want to say that i should make a table that have these columns
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Yeah, its just the way to do it.
If you have information to store thats "about a table" for example... say a comment on the table, then you can use extended properties. They arent really used for storing data though, just metadata.
|
|
|
|
|
Why dont you try to Save this in INI file with Key\Value Pair
where Key is DB name and Corresponding you want to save.
Develop2Program & Program2Develop
|
|
|
|
|
i thought so but i'm afraid, if any error occures after detaching any database then who will rollback the transaction ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I would like to make a backup CD of SQL Server that I installed onto my laptop. I did this when I had an MSDN subscription and it has run out. Other than the main program files and databases themselves, is there anything else I need to copy?
|
|
|
|
|
You may need to backup the master database as well if you need to keep logins and permissions.
|
|
|
|
|
Hello
I'm trying to use a query as a source for another query but I did'nt find the syntax to do it and I do not even know if it is possible
So I'm using a temporary table as below
Is it the right way ?
Is it another way to do it ?
CREATE TEMPORARY TABLE `tempo` <br />
SELECT DISTINCT<br />
`tours`.`dag`,<br />
`tours`.`addrID`,<br />
`tours`.`contID`,<br />
`tours`.`chauffeurID`,<br />
`tours`.`order1`<br />
FROM<br />
`tours`<br />
WHERE<br />
`tours`.`dag` = '2' AND<br />
`tours`.`chauffeurID` = '8'<br />
;<br />
SELECT DISTINCT<br />
`tours`.`dag`,<br />
`tours`.`contID`,<br />
`tours`.`chauffeurID`<br />
FROM<br />
`tempo`<br />
INNER JOIN tours ON `tempo`.`contID` = `tours`.`contID`
|
|
|
|
|
In place of a table name in the from clause a View or inline query can be used like this ....
SELECT *<br />
FROM<br />
(SELECT ColP, ColQ, ColR FROM TableA)a<br />
INNER JOIN<br />
(SELECT ColS, ColT, ColU FROM TableA)b<br />
ON a.ColP = b.ColS;
hope this is what you are trying for
Regards
KP
|
|
|
|
|
I have recently inherited a large set of databases, and have noticed that several of the dbo users have no login names associated with them. This limits several things (like assigning a database owner). Is there a way to set this value through a query, or do I have to recreate the database and import the data?
Thanks,
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
I've not get exactly what you are looking for...
however check whether sp_adduser and sp_addlogin solves your problem.
Regards
KP
|
|
|
|
|
I have an application which selects one record at a time from a SQL SERVER 7.0 database. After doing some business logic, it's updates the same record with an status flag change.
I need to run the application on 3 different machines concurrently. When I perform my SELECT of one row, how do I lock the selected record to prevent the same record being read by each instance of the application?
Thanks in advance.
Cheers
Adrian
|
|
|
|
|
I normally do something like this:
create procedure dbo.GetNextAvailable
as begin
declare @id int
set nocount on
--Start transaction so that locking works.
begin tran
--Get Id of next record to process. The "holdlock" hint tells SQL
--Server to place a lock on the row until the end of the transaction.
--The "readpast" hint tells SQL-Server to ignore a record if it is
--locked by one of your other two processes. Note that this only works
--for "read committed" isolation.
select top 1 @id = MyId from MyTable with (holdlock, readpast)
where status = 'READY'
order by MyId
--Mark the record as "in-progress" so that no-one else can pick-up
--the current record.
update MyTable set status = 'IN PROGRESS'
where MyId = @id
and status = 'READY'
--Complete the transaction.
commit trans
--Return the record to the front-end for processing. If no records
--returned then there are no records left to process.
select * from MyTable where MyId = @id
return(0)
end You could potentially move the transaction outside of the stored procedure. I normally update the status to "SUCCESS" or "FAILURE" after I have completed processing of the record. If the record processing is substantial then I normally also maintain start and end times for each record.
Regards
Andy
|
|
|
|
|
Thanks Andy, that looked like a good solution. However due to a Microsoft bug, I can't use the HOLDLOCK keyword with READPAST as I kept getting the following message: "You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels."
The bug is confirmed in this KB article: http://support.microsoft.com/kb/171322[^]
|
|
|
|
|
Your error message infers that your isolation level is not "committed read" (hence my warning about this in my original response). The MS article infers that you are trying to set the isolation-level in the "GetNext" SP, after the transaction has been started. If you are using ADO then the connection's "IsolationLevel" property should be set to "adXactReadCommitted" before the transaction starts.
You need to be really careful about the isolation level and the scope of your transaction otherwise you will find that your separate processes will have to wait for each over to complete - if you do it really wrong then you could find that parallel processing actually takes longer than using just a single process.
The technique that I specified should work even if you don't use the "READPAST" hist specified (so long as you don't start a transaction in your client-side code until AFTER you have called my SP.
Hope that helps.
Andy
|
|
|
|