Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. int [,,] myArray = new int [,,] {{1,2,3}};

int [,,] myArray = new int [,,] {{1,2,3}};

Scheduled Pinned Locked Moved C#
data-structureshelpquestion
6 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ahmad Mahmoud candseeme
    wrote on last edited by
    #1

    Hi i been awak for two nights i can't see anything infront of me BUT i must complete this int [,,] myArray = new int [,,] {{1,2,3}}; it gives me the error Incorrectly structured array initializer WHY -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

    S 1 Reply Last reply
    0
    • A Ahmad Mahmoud candseeme

      Hi i been awak for two nights i can't see anything infront of me BUT i must complete this int [,,] myArray = new int [,,] {{1,2,3}}; it gives me the error Incorrectly structured array initializer WHY -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      What exactly are you trying to do with this line of code?


      www.troschuetz.de

      A 1 Reply Last reply
      0
      • S Stefan Troschuetz

        What exactly are you trying to do with this line of code?


        www.troschuetz.de

        A Offline
        A Offline
        Ahmad Mahmoud candseeme
        wrote on last edited by
        #3

        Hi Stefan Troschütz Thank you i found the error object [,,] myArray; myArray = new object [,,] { { {"@EngCode"},{SqlDbType.Int},{TxtCode.Text} } }; --------------------------------- I Have a stroed procedure that take 13 parameter CREATE PROCEDURE dbo.CreateUser ( @EngCode int, @EngFName nvarchar(20), @EngMName nvarchar(20), @EngGName nvarchar(20), @EngLName nvarchar(20), @EngNotes nvarchar(500) , @EngineeerTypeID int, @UserName nvarchar(10), @EngMail nvarchar(50), @EngCellNo int, @EngHNo int, @UserPassword nvarchar(12), @UserNotes nvarchar(500) ) I call this proc from my C# sO SqlParameter POne = new SqlParameter(); POne.ParameterName = "@ParaName"; POne.Value = MyText.Text; POne.SqlDbType = SqlDbType.NVarChar; MyCommand.Parameters.Add ( Pone ); i will repeat this operation 13 time But if i had a Multidimensional array myArray = new object [,,] { { {"@EngCode"},{SqlDbType.Int},{TxtCode.Text} } }; and have a foreach to loop; it would be then a better idea -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

        G 1 Reply Last reply
        0
        • A Ahmad Mahmoud candseeme

          Hi Stefan Troschütz Thank you i found the error object [,,] myArray; myArray = new object [,,] { { {"@EngCode"},{SqlDbType.Int},{TxtCode.Text} } }; --------------------------------- I Have a stroed procedure that take 13 parameter CREATE PROCEDURE dbo.CreateUser ( @EngCode int, @EngFName nvarchar(20), @EngMName nvarchar(20), @EngGName nvarchar(20), @EngLName nvarchar(20), @EngNotes nvarchar(500) , @EngineeerTypeID int, @UserName nvarchar(10), @EngMail nvarchar(50), @EngCellNo int, @EngHNo int, @UserPassword nvarchar(12), @UserNotes nvarchar(500) ) I call this proc from my C# sO SqlParameter POne = new SqlParameter(); POne.ParameterName = "@ParaName"; POne.Value = MyText.Text; POne.SqlDbType = SqlDbType.NVarChar; MyCommand.Parameters.Add ( Pone ); i will repeat this operation 13 time But if i had a Multidimensional array myArray = new object [,,] { { {"@EngCode"},{SqlDbType.Int},{TxtCode.Text} } }; and have a foreach to loop; it would be then a better idea -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          You can write those five lines of code in a single line: MyCommand.Parameters.Add(new SqlParameter("@ParaName", SqlDbType.NVarChar)).Value = MyText.Text; Notice that the Add method returns a reference to the parameter, so that you can set the value property. --- b { font-weight: normal; }

          A 1 Reply Last reply
          0
          • G Guffa

            You can write those five lines of code in a single line: MyCommand.Parameters.Add(new SqlParameter("@ParaName", SqlDbType.NVarChar)).Value = MyText.Text; Notice that the Add method returns a reference to the parameter, so that you can set the value property. --- b { font-weight: normal; }

            A Offline
            A Offline
            Ahmad Mahmoud candseeme
            wrote on last edited by
            #5

            Hi Thank you very much But we should put it that way MyCommand.Parameters.Add(new SqlParameter("@ParaName", SqlDbType.NVarChar).Value = MyText.Text ); Thank You again -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

            G 1 Reply Last reply
            0
            • A Ahmad Mahmoud candseeme

              Hi Thank you very much But we should put it that way MyCommand.Parameters.Add(new SqlParameter("@ParaName", SqlDbType.NVarChar).Value = MyText.Text ); Thank You again -------------------------- If you found my answer to your question useful; then vote for me. ------------------------ Ahmad Shaban

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              No, that doesn't work. The value of the operation or assigning the string to the Value property, is the string. The result is that you will be throwing the SqlParameter object away and adding the string to the parameter collection instead. Use the method that I showed, or this even shorter one: MyCommand.Parameters.Add("@ParaName", SqlDbType.NVarChar).Value = MyText.Text; --- b { font-weight: normal; }

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups