|
Hi Frank,
You were right. I was trying to open the same DB file twice. I had the DB attached to SQL Server Express from the Web application, but when I added the data source to my VB project the connection string tries to attach the DB file again. The only way around is to progamatically connect and retrive data from the DB without using VB Express Add New Data Source.. wizard.
Thanks for your help.
Carlos
|
|
|
|
|
How can I debug stored procedures under SQL-Server 2005. Setting breakpoint and so on....
Has anybody an idea?
Thank you!
|
|
|
|
|
Hi, I asked that same question like 100 times on this forum and got no answer!
Glad to see I'm not the only one with that problem!
To debug SQL2005 you must have Visual Studio 2005 installed. (May be a marketing gimmick, dunno)
In VS2005 open the Server Explorer,
Right Click on Data Connections, choose Add Connection...
After adding the connection choose your SPROC, right-click and select Step Into Stored Procedure.
I had to do this even using SQL2000, simply because I installed VS2005.
Unfortunately VS2005 doesn't debug too well, it freezez whenever I try to stop the debugging process and for certain SPROC it never even breaks in the code, it just executes the entire procedure!
THANKS BILL!!!
Hope you run into less trouble than I did!
Good luck!
you can't forget something you never knew...
|
|
|
|
|
Thank you for your response!
Under SQL2000 you should be able to debug stored procedures with queryanalyzer, but I was never able to set it up in right way.
I hoped that that they make steps forward in sql2005.
I will get vs2005 in a few weeks, then I will try.
Thank you!
|
|
|
|
|
hi all,
I am using SQL Server 2000. I have created a DB called 'ABC'.
but today I saw that SQL DB is in 'Suspect' Mode.
So can any one please tell me how to recover the DB?
I have a backup of suspected DB. But the problem is I can not delete/Detach the DB.
thanks in advance...
|
|
|
|
|
You could turn off SQL server and copy the backup file overtop of the existing one. That is how the place I work at now does it. You can do it from a cmd prompt.
cmd> net stop mssqlserver
cmd> <copy the file>
cmd> net start mssqlserver
Steve Maier, MCSD MCAD
|
|
|
|
|
I have one of my c# applications coded using .net framework 1.1, which works fine.
Recently I installed Visual Studio 2005 - Professional edition on the same machine
(Arter formating and reinstalling Windows 2000 with SP4) and now the above application
takes a long time to open the connection to SQL Server 7.
My connection string is as follows
"user id=sa;password=;initial catalog=FINISHED_GOODS_STOCK;data source=naturubmain;Connect Timeout=30"
Once I try to open the connection it gave me 'Time out expired' error. I set the 'Connect Time out' to 0
just to find how long does it take to open the connection. It took above 1 minute and opend the
connection.
Pls help me. Withot fixing this I will not be able to enjoy the new features of VS2005
|
|
|
|
|
It looks like your not getting a connection to your SQL server. YOu also might want to try and add an Instance name to your connection string.
"user id=sa;password=;initial catalog=FINISHED_GOODS_STOCK;data source=naturubmain\DEFAULT;Connect Timeout=30"
Try and create a test connection windows ODBC tool.
|
|
|
|
|
Thanks for your advice. Later I found the problem was with the name resolving of our network. I replaced the server name with the IP address of the server in the connection string and now its working fine.
|
|
|
|
|
scenario is as below:
1. Key in password "ADMIN" , save it in a encrpyted string , such as 'Dbsaba:+='
2. Login again with password "admin"
It's working in some server and doesn't in other server.
I wonder any where in MS SQL server will trigger this case sensitive checking.
Anyone got any idea on this?
Thanks in advance!
|
|
|
|
|
The collation sequence of the Server or column (if not using the server default) determines case sensitivity.
However, you are comparing encrypted strings, so it should always be case sensitive as a word in upper case will encrypt to a different value to the same word in lowercase.
"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
|
|
|
|
|
Thanks, Colin! May i know how we can know that server or column been configured with case sensitivity? what is the command or steps?
For my case, I got no idea as both Upper case and lower case encrypted string are same. This value will passed to Stored Procedure. At server A, both (Upper & lower case) can pass the checking. While at Server B,Only 'ADMIN' can return correct value.
Thanks a lot!
|
|
|
|
|
merlynml wrote: May i know how we can know that server or column been configured with case sensitivity? what is the command or steps?
SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'MyTable'
As you are storing encrypted strings I would doubt that the collation sequence in the column has anything to do with it. A plaintext string that has been encrypted properly will produce completely different encrypted strings between the plain text being lower case or upper case or a mix of case.
Perhaps you are converting the plaintext to all upper case or all lower case prior encryption.
"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
|
|
|
|
|
Yes, you are right. I convert it to uppercase first before encryption.
But i just can't figure out why 1 server can accept both 'ADMIN' and 'admin', while one can't.
Thanks for make me clear with the problem.
|
|
|
|
|
Hi,
Application overview:
C++ application (Win32) connects to a MSDE database through ADO 2.6.
I've got a strange problem which has more to do with system settings of ADO/SQL Server (I assume).
A while ago I've written an application that connects to an MSDE database and executes some stored procedures. Yesterday I ran the application again and I received a message that a stored procedure failed. So I created a test application that connects to the database and executes a very basic stored procedure (only containing a "print" command) with one integer input parameter. The test application can connect and while executing the "execute" command of the ADO Command object an exception is received (not a COM exception but a global exception: catch(...)). When I remove the input parameter in the application and the stored procedure, no exception is thrown.
But here's the weird part, I've tested the application on 3 other PC's (one has the same OS as mine (meaning same version + all available updates)) and it works on all other PC's. The test application used to work on mine as well.
This is what I already tried (but didn't make any difference):
- I stopped my virusscanner and firewall
- I started every service that's on my PC (because I disabled a few a while ago)
- I created a new database with the same stored procedure
- I connected with another user
Does anybody has an idea/solution for this weird case?
Thanks in advance
|
|
|
|
|
Set default parameters on the SQL Stored Procedure and add debug SQL code to it that writes to a log table (include input values) . It sounds like your input parameters are getting corrupted.
Also check that someone hasn't created a view \ table \ usp \ udf with the same name but under a different user (applies to TSQL only).
-- modified at 7:06 Monday 10th April, 2006
|
|
|
|
|
Hi,
I added debug SQL code like you suggested, but there's no logging after executing the test application. So the stored procedure isn't even executed. But the code still works on all other PC's.
Regards
|
|
|
|
|
I solved the problem.
I installed ADO 2.8 SP1 and it works again.
|
|
|
|
|
I want to get the primary Key of the selected row in DataGridView when double clicked ...
You know in .net 1.1 we had a datagrid with DataKeyField property to save a special field of table like primary key field. but in DataGrid 2.0 or in DataGridView 2.0 this property disapeared...
Now! how can I get PK when a row selected ?
|
|
|
|
|
I'm using DataGrid 2.0, and I'm pretty sure that "DataKeyField" property still exists in DataGrid 2.0 .
Was it a cat I saw?
|
|
|
|
|
amin_be,
i find it easiest to simple add an invisible and disabled label with the text set to the relevent column of the database, then simply retrieve the label.Text when required.
munklefish
|
|
|
|
|
so, I have to work on my software project for a BTEC national diploma in computing but unfortunately I don't have the support I need from my teacher...
now, i won't go into the detail of the project. what i'd like to talk about is how to go about (the methodology, no actual code...) doing a load, modify, and save to a mySQL database.
I know the code, how to load and save. what i can't get straight is which of these (or any other if better) should i do:
load into dataset, modify by rows and columns, update changes
(this doesn't sound very OOP to me, i hate the idea of having to work with ds.tables[0].rows[0][1] and stuff all the time hehe)
load into dataset, parse into objects and arrays, then dump into dataset and save all
(this sounds very inefficient since saving a lot of records takes time... changing only one record doesn't count here because i would have cleared all dataset and redumped all the data which counts as 'modified' and thus the program will save all records)
load into dataset, parse, dump all data including modifications into new dataset, compare with original dataset, change modified rows only, save old dataset (with modifications)
(this seems the best option because the program will only upload the modified rows... what scares me is : what happens if i delete the first record? all rows will have to shift and thus count as modified, and we still get the inefficiency problem!!)
//god ... now i'm lost
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
In life truth does not matter. What really matters is what others believe to be the truth. (- m4nti)
|
|
|
|
|
il_manti wrote: load into dataset, modify by rows and columns, update changes
I hate that too and I don't use it ever.
il_manti wrote: load into dataset, parse into objects and arrays, then dump into dataset and save all
You're right. It is very inneficient - I don't recomment this either.
il_manti wrote: load into dataset, parse, dump all data including modifications into new dataset, compare with original dataset, change modified rows only, save old dataset (with modifications)
Unfortunately this is still inefficient - also, remember that you should be treating this data as a "set" - i.e. there is no specific order of the items in it.
What I sometimes do is:
* Load into my objects using a DataReader (that is what the data adapter is doing anyway when it populates the DataSet - I might as well remove one step, and save a lot of memory)
* You might want to consider adding a dirty flag (initial value false ) to your objects and make sure you access them via properties or methods only - no direct access you your object's fields (member variables). So any call to a set property would set the dirty flag to true .
* Update the database by applying only those objects where the dirty flag is set to true .
You might also want to look at an open source product called NHibernate which is at http://www.hibernate.org/[^]
"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
-- modified at 2:55 Friday 7th April, 2006
|
|
|
|
|
thanks a lot for the 'dirty flag' idea. i'll work on it.
i talked to another lecturer (the best in school) about this and he lectured me on the difference between object-relational and object-oriented theories... he also said people are still trying to code perfect a bridge between the two "worlds" (DLinq or something like that was one of the names he mentioned).
i'll see what i can do, thanks a lot for the reply
- m4nti
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
|
|
|
|
|
Cant get this code to work!? I need to write stuf to my database (access), but it wont work.
The errormessage I get says:
"
Operation must use an updateable query.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.
"
What do they mean with an updateble query???
////// C O D E \\\\\\\\
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim dbconn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source = C:\Inetpub\wwwroot\IED416\ied416lp3_19\db\handel.mdb")
Dim dbinsert As OleDb.OleDbCommand
dbconn.Open()
dbinsert = dbconn.CreateCommand
dbinsert.CommandText = "INSERT INTO Kunder (Namn,Ort) VALUES ('Christian','Sweden')"
dbinsert.Connection = dbconn
dbinsert.ExecuteNonQuery()
MsgBox("Weee")
dbconn.Close()
End Sub
////// C O D E \\\\\\\\
|
|
|
|