How can I get a start to develop a web page in Mojoporta?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/29/2011 11:11:41 AM
Gravatar
Total Posts 23

How can I get a start to develop a web page in Mojoporta?

Could you give me a guide? and How to connect sql server in my web page? Thanks

3/29/2011 12:44:40 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: How can I get a start to develop a web page in Mojoporta?

Browse the documentation here, and go through Joe's developer video series. The developer series covers just about anything a mojoPortal developer would need, including database access. You should really make sure that you are well versed in mojoPortal operation and administration before beginning development.

Jamie

3/29/2011 1:08:38 PM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: How can I get a start to develop a web page in Mojoporta?

 

   //On a mojo Web Page, this will get you your connection string like this
    private static string GetConnectionString()
    {
         return ConfigurationManager.AppSettings["MSSQLConnectionString"];
    }

      //I'm a stored procedure type guy
      //and in mojoPortal I use the mojoPortal.Data.SqlParameterHelper in this example
       public static int k_proc_keys_GetNextKeyByField(string fieldName)
        {
            SqlParameterHelper sph = new SqlParameterHelper(GetConnectionString(), "k_proc_keys_GetNextKeyByField", 2);
            sph.DefineSqlParameter("@FieldName", SqlDbType.NVarChar, 50, ParameterDirection.Input, fieldName);
            sph.DefineSqlParameter("@NextKey", SqlDbType.Int, ParameterDirection.Output, null);

            sph.ExecuteNonQuery();
            int newID = Convert.ToInt32(sph.Parameters[1].Value);
            return newID;
        }

        //Outside of mojoPortal in console apps I use code like this to return a DataTable
        public static DataTable ReadUrlList()
        {
            SqlConnection kickerConnection = new SqlConnection();
            kickerConnection.ConnectionString = @"Server=.\SQLEXPRESS;Database=mojoPortal_database;UID=mojouser;PWD=mojopassword;";

            DataTable UrlsDataTable = new DataTable();

            string query = "SELECT StuffGuid, StuffName from myStuff Where IsValid = 1 OR ((EndUtc Is Null) OR (EndUtc > @EndUtc))";

            SqlCommand cmd = new SqlCommand(query, kickerConnection);

            cmd.Parameters.Add("@EndUtc", SqlDbType.DateTime);
            cmd.Parameters["@EndUtc"].Value = DateTime.Now;

            SqlDataAdapter urlAdapter = new SqlDataAdapter(cmd);

            kickerConnection.Open();

            urlAdapter.Fill(myDataTable);

            kickerConnection.Close();
            urlAdapter.Dispose();

            return myDataTable;
        }

Actually the first bit of code at the top for your connection string along with a gazillion C# database examples from a Google search will get you data.

Rick

You must sign in to post in the forums. This thread is closed to new posts.