|
Hmmm. OK, with a slight change of architecture, you can use the SMO objects in Microsoft.SqlServer.Management.Common and use ServerConnection.ExecuteNonQuery to execute the original (with GO) statements as that does recognise them.
|
|
|
|
|
will you please make the changes to my code ...
Please.
So i can understand better.
|
|
|
|
|
No. I've given you all the information you need to find this out - I've told you namespaces, and given you classnames to lookup. I am not writing your code for you.
|
|
|
|
|
why not i am confused now.
Please do that favor for me
|
|
|
|
|
I think you have mistaken what these forums are for. This is not rentacoder, and you will not learn anything by me writing your code for you. Take this opportunity to learn something; read up on the SQL Management Objects and how they work. You are wasting time arguing for me to write the code for you - if it were a more complex/interesting problem, I might have taken the time because it would be more demanding for you, but because it's actually very trivial I figure you will benefit from learning how to do this.
|
|
|
|
|
but.....
thanks for solution
|
|
|
|
|
You are welcome, and good luck. If you write the code and have problems with it, I will be more than happy to help.
|
|
|
|
|
hi
i have done that just for creating views but for creating SP i get error.
|
|
|
|
|
Excuse me, but who's getting paid to write this code?? If you'd be willing to send Pete a large chunk of your paycheck, then you might persuade his to do it. Otherwise, do what you're getting paid to do, which includes teaching yourself how to do this stuff.
|
|
|
|
|
As noted Go will not work.
So WRITE code that looks for a line with ONLY that on it.
Then that code breaks your script into an array of strings. You then run each of those strings.
|
|
|
|
|
Hi,
I have a developed a winforms app with c# as the language. Integrated a word object model (Microsoft.Interop.Word 12.0 library) to fill in a word document from a word template using bookmarks. The application opens the word document on button click. This workd fine on my local machine, but when installed on a CITRIX server it is giving an error on button click (Null reference exception). The word doc opens fine when the button is clicked once, but when i close the word doc and re-click on the same button its throwing an exception.
private void btn_Click(object sender, EventArgs e)
{
oWordApp = new Word.Application();
oWordDoc = new Word.Document();
object missing = System.Reflection.Missing.Value;
object oTemplate = "C:\\Program Files\\MyTemplate.dot";
oWordDoc = oWordApp.Documents.Add(ref oTemplate, ref missing, ref missing, ref missing);
object oBookMark = "Date";
oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = DateTime.Now.ToShortDateString();
oWordApp.Application.Visible = true;
oWordApp.WindowState = Word.WdWindowState.wdWindowStateNormal;
}
Does any one know how to resolve this issue?
modified 30-Nov-11 6:32am.
|
|
|
|
|
The first thing you need to do is add some code to find out which object is giving the null reference, and then figure out why. Are you certain that everything is correctly installed on the other system to support your app?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
yeah, Word is installed on the host machine and its loading all the assemblies (so its working on button click) and its throwing a Null reference exception when the same button is clicked the second time ie after the word doc is closed and the button is clicked again.
|
|
|
|
|
Well, as I suggested before, you need to add some debug code to find out which object is throwing the exception.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All,
I was searching on Internet with this topic but dont have much luck, so i am trying my luck in here now, lol
My scenario is: i am havning a centralise release server that hosts the release applicaiton and backups, and now i would like to extend this application to allow the user to import the .reg file, sits on the release server, to a remote machine.
just as an example, in windows, if we open registry edit, and we have an option "Connect Network Registry", so we can connec to remote machine, and once we connected, we can select the .reg file from local mahcine and import into the remote machine. Our release application would like to achieve the same goal.
Hopefully i describe the scenario cleary, and since Windows is able to do it, then i am sure there is a way to do it in .Net, can someone in here point me to the right direction.
Thanks heaps.
|
|
|
|
|
Not really a C# question, you would be better of in the Quick Answers[^] section
[edit] - wrong message type (curses default option)
|
|
|
|
|
thanks a lot, will try at that section.
|
|
|
|
|
Hi All....
I want many exe to access Database That why I use Multi-Connect to solve the problem,but I make my computer slow down,so how can I use many exe with only one connection...How to fix this problem..this in advanced
|
|
|
|
|
|
I started on a project that I expected this to be a small part of, and I now realize that it is a huge undertaking.
I thought it may be a fun exercise for those of you who are better than I, and it would be helpful to a lot of us to have.
The idea is a class that can be used to iterate nmap style ip range input (eg. 192.168.45,47-50.0/24 or 172.16.*.10-25) and return a list of ip addresses in the given ranges.
I started writing it as a TargetGroup class with the intention of being able to do something like...
TargetGroup group = new TargetGroup("192.168.45,47-50.0/24");
string[] ips = group.IPAddresses();
...And have an array, or list or whatever, containing all ip addresses.
This has proven to be a pretty big deal to build reliably and efficiently.
Also, after searching around a lot, I see that nothing like this exists. With such a great utility, and no availability, this would be a great contribution to the community.
I can't spend any more time on it, and don't know that I could ever get it where it needs to be. However, if noone else jumps on it, I will revisit it as a project when I can concentrate souly on this class. For now I am going to finish the original project using a static target list with much simpler target definitions.
If anyone chooses to tackle it, good luck. I'm sure I'm not the only person who would greatly appreciate it. I will not be responsible for any hair pulled out or sleep lost trying.
2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..
|
|
|
|
|
Seems pretty straightforward, unless I'm missing something...
public static IEnumerable<IPAddress> ParseIPAddressRange(string inputString)
{
string[] tokens = inputString.Split('.');
foreach (IPAddress addr in ParseIPAddressRange(tokens, 0, string.Empty))
yield return addr;
}
private static IEnumerable<IPAddress> ParseIPAddressRange(string[] tokens, int index, string partial)
{
if (index > 3)
yield return IPAddress.Parse(partial);
else if (index >= tokens.Length || tokens[index] == "*")
{
for (int x = 0; x < 256; x++)
foreach (IPAddress addr in ParseIPAddressRange(tokens, index + 1, partial + "." + x.ToString()))
yield return addr;
}
else
{
}
}
|
|
|
|
|
This is nice code. Good C# standard. It's a good start, but doesn't do what I was suggesting. It handles breaking the octets and *, but doesn't handle - ranges , ranges or /xx CIDR notation.
I would like to see something that handles input as well as nmap
Again, nice looking code though.
2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..
|
|
|
|
|
That's the easy part.
Either use some regular expressions, or just split the strings manually:
1) Split on commas, and parse each component individually
2) Split each component by dashes, and count from one number to the other, just like I counted from 0 to 255
3) Split by slashes, and do whatever calculation is needed for CIDR notation (Too lazy to look that up right now)
Split() and int.Parse() can handle all of that.
|
|
|
|
|
Yeah. It's definitely just a lot of string manipulation, but to optimize it and make it reliable it's a much larger project than you would think until you start.
I started this project thinking that this would be a small part of it. I see now that the IPAM application will be easier to complete than this part alone. At least at my skill level.
I plan to make it a project of its own if noone beats me to it. At the moment the need is IPAM and I can get that done using a static list of simpler ip ranges. I can actually get the majority of my network with about 5 ranges as simple as xxx.xxx.xx-yy.0/24
xx.xx.xxx.0/22
and 172.16.0.0/16
That's easy.
If you don't think it'll be tough to build "well", as the nmap folks have, you should give it a shot.
Definitely doable, but it's a deceptive project.
2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..
|
|
|
|
|
Deceptive? Hardly...
foreach (string component in tokens[index].Split(','))
{
if (component.Contains('-'))
{
string[] range = component.Split('-');
if (range.Length != 2) throw new ArgumentException();
int startRange, endRange;
if (int.TryParse(range[0], out startRange) && int.TryParse(range[1], out endRange) && startRange <= endRange)
for (int x = startRange; x <= endRange; x++)
foreach (IPAddress addr in ParseIPAddressRange(tokens, index + 1, partial + "." + x.ToString()))
yield return addr;
else
throw new ArgumentException();
}
else if (component.Contains('/')
{
}
}
|
|
|
|