|
Maybe he hasn't been given an answer that solves his particular problem, but then he ought to rephrase and elaborate on the question so that we can actually guess what he wants...
|
|
|
|
|
Yes, he has. He's also been asked question to elaborate if were not understanding his question, which he's never replied to either.
|
|
|
|
|
Dear friends,
i have some problems like
i need to create application , that "creates Database,Table,Views" and need to insert default values.
at first i have created script file which contains all the operation,
then i have Executed script with help of SMO, and everything was fine, but the SMO works only where SQL server components are installed.
is it possible to create the DB,Tables, View in any other way ??
Thank you
|
|
|
|
|
You can keep your scripts in .sql files and then execute them using ADO.Net through the code.
|
|
|
|
|
Thanks....for reply
i got info form [^]
|
|
|
|
|
Hi!!
You can execute them using the .NET Sql or OleDB connector. Something like this will work
System.Data.SqlClient.SqlConnection cnn = new System.Data.SqlClient.SqlConnection([ConnectionString]);
cnn.Open();
using (System.Data.SqlClient.SqlCommand Command = new System.Data.SqlClient.SqlCommand([query], cnn))
{
Command.ExecuteNonQuery();
Command.Dispose();
cnn.Close();
cnn.Dispose();
}
Obviously if you are going to execute a bunch of query because you're going to create all the tables, insert all the defaults and such in the same process you should use transactions. Information about how to do that can be found in the MSDN, you only need to add a couple of lines more.
Hope this helps
|
|
|
|
|
I may be having dense programmer moment, but I just spent an hour debugging something that came down to a really unexpected (by me, at least) behavior with List<> vs. array. If you create a struct with a method that modifies a member, and invoke that method on an instance of the struct that resides within an array, the array element is modified as you would expect. But if you perform the identical operation on the struct that is contained in a List<structs>, the item in the List is NOT modified. The following program illustrates this...the effect is observable in VS 9 and 10.
Does this seem correct or reasonable? It certainly doesn't adhere to one of my favorite principles of language design: the principle of least surprise!
thanks, jim
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace TestByValue
{
class Program
{
static void Main(string[] args)
{
Foo[] aArray = new Foo[3];
aArray[0].Increment();
Console.WriteLine("aArray[0].x is {0} and should be {1}", aArray[0].x, 1);
Debug.Assert(aArray[0].x == 1);
List<Foo> aList = new List<Foo>();
aList.Add(new Foo());
aList[0].Increment();
Console.WriteLine("aList[0].x is {0} and should be {1}", aList[0].x, 1);
Debug.Assert(aList[0].x == 1);
}
struct Foo
{
public int x;
public void Increment()
{
x++;
}
}
}
}
|
|
|
|
|
Normally in C# most things are passed by reference so when you access the item in your list and call Increment on it you modify the actual object in the list.
However in C# structs are value types (like an Int for example) and when they are passed around what you actually get are copies. So if you had a list of Ints and you accessed them in your list you wouldn't get the actual object from the list, you just get a copy that you can do whatever you like with. If you modified the Int you'd have to actually set it back to the list to actually make any changes:
List<int> myList = new List<int>();
myList.Add(5);
myList.Add(2);
int number = myList[1];
number += 3;
myList[1] = number;
With a normal array you are actually accessing the items directly so in your case they get modified as expected, but with a generic list the array subscript operator is the same as calling a function like
int GetAtIndex(int i)
{
return theActualList[i];
}
And because the struct isn't passed by reference what you end up with is a copy of what's stored in the list and that's what you're actually modifying.
If you wanted it to work the same for both then you could simply change your struct for a class
http://msdn.microsoft.com/en-us/library/ms173109.aspx[^]
Well I hope that makes sense, it's rather late and I'm off to bed now
And I also hope I haven't made and blindingly obvious mistakes.
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius
modified on Thursday, June 3, 2010 11:28 PM
|
|
|
|
|
Thanks, SK...that's very clear, though I do think that having anObject[i].Increment() behave differently according to whether anObject is an array of Foo vs. List<foo> when Foo is a struct is error prone. I actually think I would prefer that array indexing behaved the same way...that is, the indexer returns a copy. Now that I've had time to sleep on it, I remember that a few years ago I fought through creating an indexer for my own particular struct and came to realize that I had no choice but to return a copy...so I was getting the exact same semantics as occurs with List<foo>. Maybe I won't fall into the same trap again in a couple of years. But I wouldn't count on it!
cheers, jim
|
|
|
|
|
Hi,
I'm making an app that needs a simple English wordlist. of all words in the English dictionary. I'm making a text manipulation-related application.
I need a databse or even a simple wordlists in other formats (.txt,.pdf) will do
can anyone get it for me?
|
|
|
|
|
I have something like that in an article I wrote here. It only contains 3-10 letter words (approximately 128,000 words), but you can easily find 1-2, and 11-???. I searched google for scrabble words by character count.
The article here is Anagrams - A Word Game in C#[^].
With a simple google search, I found this page (scroll down to the bottom):
http://www.manythings.org/vocabulary/lists/l/[^]
You can google, too. Really.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hey I got it1
I pasted the "Words" folder inside the Debug folder. Thanks
Now its working.
Still.. Don't you think putting them in a simple database will be more elegant (& maybe faster!!) ??
P.S: i found a small correction. It says "Prepare urself" even when 0 words are found.
Anyway nice easy to understand code!!
-- Modified Friday, June 4, 2010 3:33 AM
|
|
|
|
|
I have a simple word check program. I got lists of (167889) words from a Scrabble site somewhere.
There are two lists, one with and one without "naughty" words.
As text, they are about 2MB. As an Access database, they are about 40MB.
So I would distribute the text files, the user can then import them to the application.
|
|
|
|
|
|
My needs are different than your needs. You can certainly organize the words any way you'd like.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Well I think ur app builds almost 85% of my app.
Just small odification needed
|
|
|
|
|
If the article was useful, don't forget to give it a vote.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
i am creating a biometric voice recognition software and i want to change the default windows login screen( username and password ) to my Form... Does anyone know how to do that?
|
|
|
|
|
I'm not quite sure what you really intend to do, but I suppose that this forum thread could be useful for you.
Life is a stage and we are all actors!
|
|
|
|
|
For Windows NT to XP, you'd have to replace the GINA.DLL. You can read more about it here[^].
For Vista and 7, the security system is now extensible. You have to create a new Credential Provider. Read more on this here[^]
You cannot replace GINA with a .NET application or form. I'm not too sure you can use C# for a Credential Provider either.
|
|
|
|
|
Dave Kreskowiak wrote: You cannot replace GINA with a .NET application or form. I'm not too sure you can use C# for a Credential Provider either
Read this and am a little confused. I thought Vista was build in .Net and I assume Windows 7 as well, so why would you not be able to use .Net for this? (In addition "Credential Provider" sounds very .Net like )
Just curious.
V.
|
|
|
|
|
V. wrote: I thought Vista was build in .Net and I assume Windows 7 as well
So far as I am aware there are no parts of any M$ operating system that are written in .Net. Both Vista and Wevenjs install the .net libraries but they are not written using it.
Visual Studio 2010 uses WPF for its Editor, maybe that is what you are thinking of?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Not really, but I'm probably dreaming in that case, thx.
V.
|
|
|
|
|
V. wrote: I thought Vista was build in .Net and I assume Windows 7 as well
No, they're not. I would have cost Microsoft BILLIONS of dollars to rewrite the entire Windows kernel in .NET.
V. wrote: (In addition "Credential Provider" sounds very .Net like )
It sounds very modular and better designed, not .NET'ish.
|
|
|
|
|