|
SQL Server actually runs as a Service. What you see in the Systray is the Service Manager which allows you to start, stop and pause the SQL Server service on the server you specify.
Check that the service is running.
Also, did you install your SQL Server as a named instance? That is what the "NetSDK" bit means - you can install SQL Server many times on a single machine. By default the installation will create an instance without a name. The Service Manager will probably list all the instances you have (I don't recall of the top of my head, and I am only running one instance that has no name)
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Colin,
According to the SQL Server Service Manager, a SQL Server is running on my local machine. I installed MSSQL Server 2000 by running Program Files\Microsoft Visual studio .NET\FrameworkSDK\Samples\Setup\msde\setup\sql2000.msi. This installation package did not ask me to supply a server name.
When I removed the "NetSDK" bit, I got a different error:
Login failed for user 'IANANDKRISTA\Ian'.
|
|
|
|
|
Okay, you have at least established a connection to your SQL Server - but you also need to supply the correct userid and password. All SQL servers will have an "sa" account (System Admin) and if you haven't changed it then chances are its password will be blank.
Also, since your using MSDE (the Desktop Edition of SQL Server) you don't have all the nice GUI bits that make changing passwords, adding users and so on easy.
Once your logged in as sa, you need to run the query:
exec sp_grantlogin N'IANANDKRISTA\Ian'
Then you can log in automatically while you are logged into Windows.
Does this help?
Disclaimer: I use the Enterprise edition of SQL Server so I'm more used to the GUI which handles all this stuff - so, appologies in advance if I've missed something.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
How do I log in as the system administrator in order to run the query you suggest? Also, does the enterprise edition of SQL Server come with Visual Studio .NET? If not, where do I get it? (it sounds easier to use than the Desktop Edition, which I didn't even know I was running).
Thanks,
-Ian
|
|
|
|
|
According to the On-line help replacing the -E with -U sa from your original command line should do the trick.
Ian Bowler wrote:
Also, does the enterprise edition of SQL Server come with Visual Studio .NET?
The Enterprise edition is the version that is installed in companies' back-offices and is kind of expensive. The Developer Edition is identical except for the licence and maybe one or minor details. IIRC the Enterprise Edition must be run on a Server Edition of Windows, while the Developer Edition can run on a regular Windows 2000/XP machine.
The Developer edition also comes with some levels of MSDN subscription.
You can also download a 120-day trial version from Microsoft: http://www.microsoft.com/sql/evaluation/trial/default.asp[^] Which will give you everything you need. And it should be easy from the installation to name the server to fit with the examples in your book.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
You have been extremely generous with your time.
I have successfully logged in to the 'sa' account. However, I do have a security question now. I am going to post this question as a new topic.
Thank you so much for your help. Without your answers, I'd still be nowhere.
-Ian
|
|
|
|
|
Glad to help. Good luck learning about SQL Server.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
SQL Server and the MSDE can run up to 16 instances, inclusive. That's 16 total between the two, since SQL Server and the MSDE share the same engine.
The default installation for the MSDE that comes on the VS.NET CDs/DVD is not the default (unnamed) instance. Last time I checked, it was VSdotNET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear, Sir and Madam.
Please see my code
public class Test
{
public string name;
public string title;
public Test[] Tests;
}
If I get an Test object (name = x) in Test object,
how to know the path of x?
Is there the better way than looping the object?
Sorry for bad English.
Thank You.
|
|
|
|
|
You just have to recurse and construct the "path" yourself. This would be a very simple recursive loop to create.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear, Sir and Madam.
To compare integer use the following code
if (i==j) //i and j is integer
DoSomething();
If i and j is MemoryStream, how to compare them
Sorry for bad English.
Thank You.
|
|
|
|
|
Only primitive types and those that define the equality operators are comparable using == , otherwise a simple reference (whether i and j referenece the same object) is performed. Classes may also override Object.Equals ; if they don't, again simple reference equality is used.
Since MemoryStream nor its base class, Stream , define either of these, you must compare these byte-for-byte yourself:
public int Compare(MemoryStream a, MemoryStream b)
{
if (a == null && b == null) return 0;
else if (a == null || b == null) throw new ArgumentNullException(
a == null ? "a" : "b");
if (a.Length < b.Length) return -1;
else if (a.Length > b.Length) return 1;
byte buf;
while ((buf = a.ReadByte()) >= 0)
{
int diff = buf.CompareTo(b.ReadByte());
if (diff != 0) return diff;
}
return 0;
} As with most comparisons in the BCL, 0 is returned if the two streams are equal. a negative or positive integer value is returned depending on the conditions, which should be obvious from the code above.
Note that this is only an example, but should give you an idea of how to compare the MemoryStream s.
You could also P/Invoke the memcmp function, although this will hinder the portability of your code but will be very fast.
As I covered a few days ago with the same question (hint: it's a good idea to try searching for previous questions before posting), you can P/Invoke memcmp like so:
public sealed class ByteComparer
{
private ByteComparer();
public static int Compare(byte[] a, byte[] b)
{
return memcmp(a, b, new IntPtr(a.Length)).ToInt32();
}
[DllImport("msvcrt.dll")]
private static extern IntPtr memcmp(byte[] a, byte[] b, IntPtr count);
} This does a comparison using the native memcmp API if you just pass two byte[] arrays (which you can get easily using MemoryStream.ToArray ) into the static method Compare :
MemoryStream a = ...;
MemoryStream b = ...;
int diff = ByteComparer.Compare(a.ToArray(), b.ToArray());
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It might be worth adding:
if( a == b )
return 0; in case anyone does try to do Compare( a, a ) . It might seem unlikely, but you have to consider aliasing.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Good idea. Might save quite a bit of time since the byte for byte comparison would run max(O(n)) just to return 0.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
First of all, this is best suited for a good abstract model. A Person class, for example, would define the common properties and derivative classes (like Executive , Manager , etc.) would define additional properties specific to them (perhaps even extend Person with a Supervisor class, and the latter two classes derive from Supervisor since they would ultimately have something in common).
If you want the PropertyGrid to display properties at runtime that aren't actually defined on the class, implement the ICustomTypeDescriptor on your class. For the most part, just call TypeDescriptor methods for each interface member implementation, passing true for the parameter typically called noCustomTypeDesc . For example:
TypeConverter ICustomTypeDescriptor.GetConverter()
{
return TypeDescriptor.GetConverter(this, true);
} For the two ICustomTypeDescriptor.GetProperties overloads, you return a PropertyDescriptorCollection with the defined properties and shadowed properties.
You can find more information about the ICustomTypeDescriptor in the .NET Framework SDK, but implementing will require understanding the .NET ComponentModel, so I suggest you read Enhancing Design-Time Support[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello...
I have a problem...
I want to delete a file but i cant delete it, it thwors an error an sais acces denied!
I have tried this...
string FileFullDest = "C:\test\test.dl";
FileInfo Delete = new FileInfo(FileFullDest);
Delete.Delete();
Don't know what else to do!
Anyone who can help me?
|
|
|
|
|
You can also use File.Delete , but the result is the same if you don't have the necessary file system permissions (for that particular file) or code access security (i.e., permission to delete any file via code in .NET).
Please be more descriptive. What is the exact exception type (ex: SecurityException , etc.) and message text? From where is the application that contains this code run (i.e., local computer, intranet server, etc.)?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
it trows an IOException!
it sais -> the process cannot access the file "c:\test\test.dll" because it is being used by another process!
But isn't it possible to delete it anyway?
|
|
|
|
|
Not if another process is using it, no. Whatever process has loaded and mapped test.dll into its process space must be shutdown first. Operating systems are supposed to protected against this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
And there is no way to stop the process at run time?
|
|
|
|
|
Yes, but you have to know what the process is. You also shouldn't just go stopping processes just so you can delete a file.
See the System.Diagnostics.Process class for a way to get a list of running processes. You'd have to enumerate them and then enumerate their Process.Modules property to find which process is using test.dll, then attempt to close it gracefully using Process.Close . If that doesn't work, use Process.Kill to terminate it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
okay i try that!!
thansk!!
|
|
|
|
|
I sense impending disaster.
|
|
|
|
|