Deploy SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogarajan
    New Member
    • Apr 2007
    • 115

    Deploy SQL

    hello friends

    my requirement is Deploy SQL Server databases easily with an Installer class
    so i am using



    but i am got error

    Code:
    private static string GetScript(string name)
    {
        Assembly asm = Assembly.GetExecutingAssembly();
        Stream str = asm.GetManifestResourceStream(
                        asm.GetName().Name+ "." + name);
        StreamReader reader = new StreamReader(str);
        return reader.ReadToEnd();
    }
    Stream str return null

    why
    pls help me
    Last edited by tlhintoq; Aug 10 '09, 06:27 PM. Reason: [CODE] ...your code goes here... [/CODE] tags added
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I'm not a big SQL guy and may totally out of area but... Is this really right?
    asm.GetName().N ame+ "." + name
    Where the file name passed in as a parameter appears to be an extension?

    I'm also guess that if any part of the assignment (right side of = " fails then str will not be assigned anything. So is it possible that "asm.Getname(). Name" is failing?

    Can you break it down to check each part?
    Code:
    Stream str = asm.GetManifestResourceStream(
                        asm.GetName().Name+ "." + name);
    Assign asm.GetName().N ame to a string and see what you get.
    Code:
    string GottenName = asm.GetName().Name;// Breakpoint here
    Stream str = asm.GetManifestResourceStream(GottenName + "." + name);

    Comment

    • yogarajan
      New Member
      • Apr 2007
      • 115

      #3
      Re:HI

      Hi

      this is also return null value
      same error

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        Originally posted by yogarajan
        Hi

        this is also return null value
        same error
        I assume you are saying that you tried breaking it down and that
        Code:
        string GottenName = asm.GetName().Name;// Breakpoint here
        is what is returning the null value.

        So there you go. Now you know where the null is coming from. So asm.GetName().N ame is not doing what you thought it would, or what you expected. Now you have a place to start your next phase of trial and error (research).

        Sometimes just breaking down complex/compound statements can be helpful.

        Comment

        Working...