Entries Tagged as 'Dot net'

connecting to Mysql using ODBC windows drivers within ASP code file

Many times in ASP or dot net we may need to connect to a mysql database.For making a connection to mysql database we need to install mysql connector for windows which you can download from:-

http://dev.mysql.com/get/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.5-win32.msi/from/pick?file=Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.5-win32.msi&mirror=pick&file=Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.5-win32.msi&mirror=pick

After downloading this connector just install it.and follow the instructions at mysql site:-
http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-dsn-windows.html

So all is done…

enjoy mysql databases in ASP code file now :)


SQL Server commands dot net nuke Getting table structure procedure

There are manby things which are considered as basics in dot net nuke.When you are using host sql window from dnn then most definitely you will need to have ideas of basic sql statements to fetch info from db.Few of them are:-

Listing all tables from DataBase:-

SELECT * FROM information_schema.Tables

Get Stored procedure description and Structure:-

select * from information_schema.routines where routine_name = ‘Stored Procedure Name’

Querry to fetch all tables in a database:

select * from sysobjects where type=’u’

Querry to fetch all procedures in a database:

select * from sysobjects where type=’p’

Display Table Creation And Owner info

sp_help table_name

Display Table structure and columns:-

sp_columns @table_name = ‘table_name

this will show all fields from table table_name including data type and length information.

Return a list of objects that can be queried in the current environment
EXEC sp_tables
Return information about the syscolumns table in the Company database
EXEC sp_tables syscolumns, dbo, Company, "'SYSTEM TABLE'"

Altering/modifying cloumn Width :-
alter table table_name ALTER COLUMN column_name varchar(30)

Getting Started with DNN-Creating first DotnetNuke module(DNN custom module)

What do you need to do to create a Simple first DotNetNuke (DNN) module?(contact form)

  1. Set up your development environment
  2. Under DesktopModules create a folder called contactme
  3. Create three files under contactme folder
    • contactme.dnn
    • Viewcontactme.ascx
    • Viewcontactme.ascx.cs
  4. Code for Contactme.dnn:-
    <dotnetnuke version=”3.0″ type=”Module”>
    <folders>
    <folder>
    <name>Phinest.contactme</name>
    <friendlyname>contactme</friendlyname>
    <foldername>Phinest.contactme</foldername>
    <modulename>Phinest.contactme</modulename>
    <description>A contactme module</description>
    <version>01.00.00</version>
    <businesscontrollerclass>Phinest.Modules.contactme.contactmeController</businesscontrollerclass>
    <modules>
    <module>
    <friendlyname>contactme</friendlyname>
    <cachetime>60</cachetime>
    <controls>
    <control>
    <src>DesktopModules/contactme/Viewcontactme.ascx</src>
    <type>View</type>
    <helpurl></helpurl>
    </control>
    </controls>
    </module>
    </modules>
    <files>
    <file>
    <name>Viewcontactme.ascx</name>
    </file>
    <file>
    <name>Viewcontactme.ascx.cs</name>
    </file>
    </files>
    </folder>
    </folders>
    </dotnetnuke>
  5. Code for contactme.aspx<%@ Control language=”C#” Inherits=”Phinest.Modules.contactme.Viewcontactme” CodeFile=”Viewcontactme.ascx.cs” AutoEventWireup=”true” Explicit=”True”%>

    Form here

  6. Code for contactme.aspx.csusing System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Phinest.Modules.contactme
    {
    partial class Viewcontactme : PortalModuleBase, IActionable
    {
    private string strTemplate;
    protected void Page_Load(System.Object sender, System.EventArgs e)
    {
    try
    {
    if (!Page.IsPostBack)
    {
    }
    }
    catch (Exception exc) //Module failed to load
    {
    Exceptions.ProcessModuleLoadException(this, exc);
    }

    }
    }
    }