예제 #1
0
        public MySmo.DataType GetDataType(Smo.Column c)
        {
            var dt = c.DataType;

            if (dt.SqlDataType == Smo.SqlDataType.UserDefinedDataType)
            {
                var db = c.GetDatabase();
                var ut = db.UserDefinedDataTypes[c.DataType.Name, c.DataType.Schema];
                var st = Utils.GetSqlDataType(ut.SystemType, ut.MaxLength);
                dt = new Smo.DataType(st)
                {
                    MaximumLength    = ut.MaxLength,
                    NumericPrecision = ut.NumericPrecision,
                    NumericScale     = ut.NumericScale
                };
            }
            return(new MySmo.DataType
            {
                Name = dt.Name,
                Schema = dt.Schema,
                MaximumLength = dt.MaximumLength,
                NumericPrecision = dt.NumericPrecision,
                NumericScale = dt.NumericScale,
                SqlDataType = (MySmo.SqlDataType)(int) dt.SqlDataType
            });
        }
예제 #2
0
 Smo.Column AddColumn(Smo.Table t, string columnName, Smo.DataType dt, bool isNullable)
 {
     Smo.Column c = new Smo.Column(t, columnName, dt);
     t.Columns.Add(c);
     c.Nullable = isNullable;
     return(c);
 }
예제 #3
0
        /// <summary>
        /// Gets a string representation of the provided data type specific to the language option.
        /// </summary>
        /// <param name="dataType">The provided data type.</param>
        /// <returns>
        /// A string representation of the provided data type.
        /// </returns>
        public string GetTypeString(Smo.DataType dataType)
        {
            switch (dataType.SqlDataType)
            {
            case Smo.SqlDataType.Bit:
                return("System.Boolean");

            case Smo.SqlDataType.SmallDateTime:
                return("System.DateTime");

            case Smo.SqlDataType.Int:
                return("System.Int32");

            case Smo.SqlDataType.NVarChar:
                return("System.String");

            case Smo.SqlDataType.VarChar:
                return("System.String");

            default:
                return("System.String");
            }
        }
        /// <summary>
        /// Gets a string representation of the provided data type.
        /// </summary>
        private static string GetDbTypeString(Smo.DataType dataType)
        {
            switch (dataType.SqlDataType)
            {
            case Smo.SqlDataType.Bit:
                return("Binary");

            case Smo.SqlDataType.SmallDateTime:
                return("DateTime");

            case Smo.SqlDataType.Int:
                return("Int32");

            case Smo.SqlDataType.NVarChar:
                return("String");

            case Smo.SqlDataType.VarChar:
                return("String");

            default:
                return("String");
            }
        }
예제 #5
0
        private void columnsPage_ShowFromNext(object sender, EventArgs e)
        {
            columnsGrid.Rows.Clear();
            idColumnComboBox.Items.Clear();

            TableFactory tf        = new TableFactory();
            string       tableName = m_Edit.TableName;

            Smo.Table t = tf.FindTableByName(tableName);

            if (t == null)
            {
                return;
            }

            // Get any domains already associated with the table
            IColumnDomain[] curDomains = m_Edit.ColumnDomains;

            columnsGrid.RowCount = t.Columns.Count;

            for (int i = 0; i < columnsGrid.RowCount; i++)
            {
                Smo.Column c = t.Columns[i];
                idColumnComboBox.Items.Add(c.Name);

                DataGridViewRow row = columnsGrid.Rows[i];
                row.Cells["dgcColumnName"].Value = c.Name;

                Smo.DataType dt       = c.DataType;
                string       dataType = dt.SqlDataType.ToString().ToLower();

                if (dt.SqlDataType == Smo.SqlDataType.Char ||
                    dt.SqlDataType == Smo.SqlDataType.NChar ||
                    dt.SqlDataType == Smo.SqlDataType.VarChar ||
                    dt.SqlDataType == Smo.SqlDataType.NVarChar)
                {
                    dataType += String.Format("({0})", dt.MaximumLength);
                }

                if (!c.Nullable)
                {
                    dataType += " not null";
                }

                row.Cells["dgcDataType"].Value = dataType;

                // Display any domain previously associated with the column
                IColumnDomain cd = Array.Find <IColumnDomain>(curDomains,
                                                              delegate(IColumnDomain tcd) { return(tcd.ColumnName == c.Name); });
                if (cd != null)
                {
                    row.Cells["dgcDomain"].Value = cd.Domain;
                }

                row.Tag = c;
            }

            // Nothing initially selected
            columnsGrid.CurrentCell = null;

            // If we have a simple primary key, assume it's the feature ID column
            if (String.IsNullOrEmpty(m_Edit.IdColumnName))
            {
                Smo.Column pk = TableFactory.GetSimplePrimaryKeyColumn(t);
                if (pk != null)
                {
                    idColumnComboBox.SelectedItem = pk.Name;
                }
            }
            else
            {
                idColumnComboBox.SelectedItem = m_Edit.IdColumnName;
            }
        }
예제 #6
0
 Smo.Column AddColumn(Smo.Table t, DataColumn dc)
 {
     Smo.DataType dt = GetDataType(dc);
     return(AddColumn(t, dc.ColumnName, dt, dc.AllowDBNull));
 }
예제 #7
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            m_strNewNetworkName = textBoxNetworkName.Text;
            String strWhere = textBoxFilter.Text;

            this.Cursor = Cursors.WaitCursor;
            if (m_strNewNetworkName.Trim() == "")
            {
                Global.WriteOutput("Error: Network Name must be entered..");
                this.Cursor = Cursors.Default;
                return;
            }
            //Check if Network Name is already in use.

            String strSelect = "SELECT * FROM NETWORKS WHERE NETWORK_NAME='" + m_strNewNetworkName + "'";

            String strDescription      = "";
            String strDesignerUserID   = "";
            String strDesignerUserName = "";

            //String strLock = "";
            //String strPrivate = "";



            try
            {
                DataSet ds = DBMgr.ExecuteQuery(strSelect);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    //Network with this name exists.
                    Global.WriteOutput("Error: Network with this name already exists.  Please select another.");
                    this.Cursor = Cursors.Default;
                    return;
                }
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Checking Network Name uniqueness.   Please select a different Network Name." + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }



            strSelect = "SELECT * FROM NETWORKS WHERE NETWORKID=" + m_strNetworkID;
            try
            {
                DataSet ds = DBMgr.ExecuteQuery(strSelect);

                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];

                    strDescription      = dr["DESCRIPTION"].ToString();
                    strDesignerUserID   = dr["DESIGNER_USERID"].ToString();
                    strDesignerUserName = dr["DESIGNER_NAME"].ToString();
                    //strLock = dr["LOCK_"].ToString();
                    //strPrivate = dr["PRIVATE_"].ToString();
                }
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Checking Network Name uniqueness.   Please select a different Network Name." + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }



            String strInsert = "INSERT INTO NETWORKS (NETWORK_NAME";
            String strValues = " VALUES ('" + m_strNewNetworkName + "'";

            if (strDescription != "")
            {
                strInsert += ",DESCRIPTION";
                strValues += ",'" + strDescription + "'";
            }


            if (strDesignerUserID != "")
            {
                strInsert += ",DESIGNER_USERID";
                strValues += ",'" + strDesignerUserID + "'";
            }

            if (strDesignerUserName != "")
            {
                strInsert += ",DESIGNER_NAME";
                strValues += ",'" + strDesignerUserName + "'";
            }


            //if (strLock != "")
            //{
            //    strInsert += ",LOCK_";
            //    strValues += ",'" + strLock + "'";
            //}

            //if (strPrivate != "")
            //{
            //    strInsert += ",PRIVATE_";
            //    strValues += ",'" + strPrivate + "'";
            //}

            strInsert += ",DATE_CREATED";
            switch (DBMgr.NativeConnectionParameters.Provider)
            {
            case "MSSQL":
                strValues += ",'" + DateTime.Now.ToString() + "'";
                break;

            case "ORACLE":
                strValues += ",to_date('" + DateTime.Now.ToString("MM/dd/yyyy") + "','MM/DD/YYYY')";
                break;

            default:
                throw new NotImplementedException("TODO: Implement ANSI version of buttonCreate_Click()");
            }

            strInsert += ",DATE_LAST_EDIT)";

            switch (DBMgr.NativeConnectionParameters.Provider)
            {
            case "MSSQL":
                strValues += ",'" + DateTime.Now.ToString() + "')";
                break;

            case "ORACLE":
                strValues += ",to_date('" + DateTime.Now.ToString("MM/dd/yyyy") + "','MM/DD/YYYY'))";
                break;

            default:
                throw new NotImplementedException("TODO: Implement ANSI version of buttonCreate_Click()");
            }



            strInsert += strValues;

            try
            {
                DBMgr.ExecuteNonQuery(strInsert);
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Creating new subnetwork NETWORKS entry" + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }


            String strIdentity = "";

            switch (DBMgr.NativeConnectionParameters.Provider)
            {
            case "MSSQL":
                strIdentity = "SELECT IDENT_CURRENT ('NETWORKS') FROM NETWORKS";
                break;

            case "ORACLE":
                //strIdentity = "SELECT NETWORKS_NETWORKID_SEQ.CURRVAL FROM DUAL";
                //strIdentity = "SELECT LAST_NUMBER - CACHE_SIZE  FROM USER_SEQUENCES WHERE SEQUENCE_NAME = 'NETWORKS_NETWORKID_SEQ'";
                strIdentity = "SELECT MAX(NETWORKID) FROM NETWORKS";
                break;

            default:
                throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                //break;
            }
            try
            {
                DataSet ds = DBMgr.ExecuteQuery(strIdentity);
                strIdentity = ds.Tables[0].Rows[0].ItemArray[0].ToString();
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Creating new subnetwork NETWORKS entry." + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }

            //Now have the new NetworkInserted.  Must create tables.  SECTION_NID  and SEGMENT_NID_NS0

            String strSelectSection = "SELECT SECTION_" + m_strNetworkID + ".SECTIONID,FACILITY,BEGIN_STATION,END_STATION,DIRECTION,SECTION,AREA,UNITS,GEOMETRY,Envelope_MinX,Envelope_MaxX,Envelope_MinY,Envelope_MaxY FROM SECTION_" + m_strNetworkID + " INNER JOIN SEGMENT_" + m_strNetworkID.ToString() + "_NS0 ON SECTION_" + m_strNetworkID.ToString() + ".SECTIONID=SEGMENT_" + m_strNetworkID + "_NS0.SECTIONID";

            if (strWhere.Trim() != "")
            {
                strSelectSection += " WHERE " + strWhere;
            }


            //String strSelectSegment = "SELECT * FROM SEGMENT_" + m_strNetworkID + "_NS0";

            String strSelectSegment = "SELECT * " + DBOp.BuildFromStatement(m_strNetworkID);

            if (strWhere.Trim() != "")
            {
                strSelectSegment += " WHERE " + strWhere;
                this.Cursor       = Cursors.Default;
            }

            //In
            try
            {   // Create new SECTION_
                // Create new tables
                // SEGMENT_networkid
                // This table is for SECTIONID, FACILITY, BEGIN_STATION, END_STATION, DIRECTION, SECTION,AREA,UNITS
                List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>();
                listColumn.Add(new DatabaseManager.TableParameters("SECTIONID", DataType.Int, false, true));
                listColumn.Add(new DatabaseManager.TableParameters("FACILITY", DataType.VarChar(4000), false));
                listColumn.Add(new DatabaseManager.TableParameters("BEGIN_STATION", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("END_STATION", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("DIRECTION", DataType.VarChar(50), true));
                listColumn.Add(new DatabaseManager.TableParameters("SECTION", DataType.VarChar(4000), false));
                listColumn.Add(new DatabaseManager.TableParameters("AREA", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("UNITS", DataType.VarChar(50), true));
                listColumn.Add(new DatabaseManager.TableParameters("GEOMETRY", DataType.VarChar(-1), true));
                listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MINX", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MAXX", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MINY", DataType.Float, true));
                listColumn.Add(new DatabaseManager.TableParameters("ENVELOPE_MAXY", DataType.Float, true));

                List <string> orderedOracleColumns = new List <string>();
                orderedOracleColumns.Add("SECTIONID");
                orderedOracleColumns.Add("FACILITY");
                orderedOracleColumns.Add("BEGIN_STATION");
                orderedOracleColumns.Add("END_STATION");
                orderedOracleColumns.Add("DIRECTION");
                orderedOracleColumns.Add("SECTION");
                orderedOracleColumns.Add("AREA");
                orderedOracleColumns.Add("UNITS");
                orderedOracleColumns.Add("GEOMETRY");
                orderedOracleColumns.Add("ENVELOPE_MINX");
                orderedOracleColumns.Add("ENVELOPE_MAXX");
                orderedOracleColumns.Add("ENVELOPE_MINY");
                orderedOracleColumns.Add("ENVELOPE_MAXY");

                String strTable = "SECTION_" + strIdentity;
                DBMgr.CreateTable(strTable, listColumn);

                //String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                //strMyDocumentsFolder += "\\RoadCare Projects\\Temp";
                //Directory.CreateDirectory(strMyDocumentsFolder);
                string specialFolder = Directory.GetCurrentDirectory() + "\\Temp";
                Directory.CreateDirectory(specialFolder);
                String     strOutFile = specialFolder + "\\subnetwork_section.txt";
                TextWriter tw         = new StreamWriter(strOutFile);
                DataSet    dsSection  = DBMgr.ExecuteQuery(strSelectSection);
                foreach (DataRow dr in dsSection.Tables[0].Rows)
                {
                    String strOut = "";
                    for (int i = 0; i < dr.ItemArray.Length; i++)
                    {
                        strOut += dr.ItemArray[i].ToString();
                        if (i == dr.ItemArray.Length - 1)
                        {
                            tw.WriteLine(strOut);
                        }
                        else
                        {
                            strOut += "\t";
                        }
                    }
                }
                tw.Close();
                switch (DBMgr.NativeConnectionParameters.Provider)
                {
                case "MSSQL":
                    DBMgr.SQLBulkLoad(strTable, strOutFile, '\t');
                    break;

                case "ORACLE":
                    DBMgr.OracleBulkLoad(DBMgr.NativeConnectionParameters, strTable, strOutFile, orderedOracleColumns, "\t");
                    break;

                default:
                    throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                    //break;
                }
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Creating SECTION_ table for Network = " + m_strNewNetworkName + ". " + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }


            try
            {
                DataSet dsSegment = DBMgr.ExecuteQuery("SELECT * FROM SEGMENT_" + m_strNetworkID + "_NS0");
                List <DatabaseManager.TableParameters> listColumn = new List <DatabaseManager.TableParameters>();
                foreach (DataColumn dc in dsSegment.Tables[0].Columns)
                {
                    DataType dt = DataType.Int;
                    Microsoft.SqlServer.Management.Smo.DataType smoDT = Microsoft.SqlServer.Management.Smo.DataType.Int;
                    if (dc.DataType == typeof(int))
                    {
                        smoDT = Microsoft.SqlServer.Management.Smo.DataType.Int;
                    }
                    if (dc.DataType == typeof(double))
                    {
                        smoDT = Microsoft.SqlServer.Management.Smo.DataType.Float;
                    }
                    if (dc.DataType == typeof(string))
                    {
                        smoDT = Microsoft.SqlServer.Management.Smo.DataType.VarChar(4000);
                    }


                    if (dc.ColumnName == "SECTIONID")
                    {
                        listColumn.Add(new DatabaseManager.TableParameters(dc.ColumnName, smoDT, false, true));
                    }
                    else
                    {
                        listColumn.Add(new DatabaseManager.TableParameters(dc.ColumnName, smoDT, true, false));
                    }
                }
                String strTable = "SEGMENT_" + strIdentity + "_NS0";
                DBMgr.CreateTable(strTable, listColumn);

                String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                strMyDocumentsFolder += "\\RoadCare Projects\\Temp";
                Directory.CreateDirectory(strMyDocumentsFolder);


                String     strOutFile = strMyDocumentsFolder + "\\subnetwork_segment.txt";
                TextWriter tw         = new StreamWriter(strOutFile);
                DataSet    dsSection  = DBMgr.ExecuteQuery(strSelectSection);

                foreach (DataRow dr in dsSegment.Tables[0].Rows)
                {
                    String strOut = "";
                    for (int i = 0; i < dr.ItemArray.Length; i++)
                    {
                        strOut += dr.ItemArray[i].ToString();
                        if (i == dr.ItemArray.Length - 1)
                        {
                            tw.WriteLine(strOut);
                        }
                        else
                        {
                            strOut += "\t";
                        }
                    }
                }
                tw.Close();
                switch (DBMgr.NativeConnectionParameters.Provider)
                {
                case "MSSQL":
                    DBMgr.SQLBulkLoad(strTable, strOutFile, '\t');
                    break;

                case "ORACLE":
                    List <string> oracleSegmentColumns = new List <string>();
                    foreach (DataColumn segmentColumn in dsSegment.Tables[0].Columns)
                    {
                        oracleSegmentColumns.Add(segmentColumn.ColumnName);
                    }
                    DBMgr.OracleBulkLoad(DBMgr.NativeConnectionParameters, strTable, strOutFile, oracleSegmentColumns, "\t");
                    //throw new NotImplementedException("TODO: figure out columns for buttonCreate_Click()");
                    //DBMgr.OracleBulkLoad( DBMgr.NativeConnectionParameters, strTable, strOutFile,
                    break;

                default:
                    throw new NotImplementedException("TODO: Create ANSI implementation for XXXXXXXXXXXX");
                    //break;
                }
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Creating SEGMENT_ table for Network = " + m_strNewNetworkName + ". " + exception.Message);
                this.Cursor = Cursors.Default;
                return;
            }

            strSelect = "SELECT * FROM SEGMENT_CONTROL WHERE NETWORKID = " + m_strNetworkID;

            try
            {
                DataSet ds = DBMgr.ExecuteQuery(strSelect);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    String strTable = dr["SEGMENT_TABLE"].ToString();
                    strInsert = "";
                    if (strTable.Contains("SECTION"))
                    {
                        strInsert = "INSERT INTO SEGMENT_CONTROL (NETWORKID,SEGMENT_TABLE) VALUES (" + strIdentity + ",'SECTION_" + strIdentity + "')";
                    }
                    else
                    {
                        strInsert = "INSERT INTO SEGMENT_CONTROL (NETWORKID,SEGMENT_TABLE";
                        String strValue = " VALUES (" + strIdentity + ",'SEGMENT_" + strIdentity + "_NS0'";

                        if (dr["ATTRIBUTE_"].ToString() != "")
                        {
                            strInsert += ",ATTRIBUTE_";
                            strValue  += ",'" + dr["ATTRIBUTE_"].ToString() + "'";
                        }

                        strInsert += ")" + strValue + ")";
                    }
                    DBMgr.ExecuteNonQuery(strInsert);
                }
            }
            catch (Exception exception)
            {
                Global.WriteOutput("Error: Inserting values into SEGMENT_CONTROL." + exception.Message);
            }

            Global.SecurityOperations.CopyNetworkPoliciesFromTo(m_strNetworkID, strIdentity);


            NewNetworkID      = strIdentity;
            this.DialogResult = DialogResult.OK;
            this.Close();
            this.Cursor = Cursors.Default;
        }
        public void IntializeDatabase()
        {
            if (Logger != null)
            {
                Logger.Log(LogLevel.Information, $"Initializing Database {DatabaseName}");
            }
            var database = (SqlServerDatabase)GetDatabase();

            if (!database.Schemas.Any(s => s.Name == _VersionSchema))
            {
                var schema = new Schema(database.SmoDatabase, "version");
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Information, $"Creating version Schema in {DatabaseName}");
                }
                schema.Create();
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Debug, $"Created version Schema in {DatabaseName}");
                }
            }

            if (!database.Tables.Any(t => t.Name == _VersionTable && ((SqlServerTable)t).Schema == _VersionSchema))
            {
                var table = new Table(database.SmoDatabase, "Log", "version");
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Information, $"Creating version.Log Table in {DatabaseName}");
                }

                var scriptColumnName     = "Script";
                var fileNameColumnName   = "FileName";
                var deployDateColumnName = "DeployDate";

                var scriptColumn = new Column(table, scriptColumnName, DataType.NVarChar(2000));
                scriptColumn.Nullable = false;
                table.Columns.Add(scriptColumn);

                var fileNameColumn = new Column(table, fileNameColumnName, DataType.NVarCharMax);
                fileNameColumn.Nullable = false;
                table.Columns.Add(fileNameColumn);

                var deployDateColumn = new Column(table, deployDateColumnName, DataType.DateTimeOffset(7));
                deployDateColumn.Nullable = false;
                table.Columns.Add(deployDateColumn);

                table.Create();
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Debug, $"Created version.Log Table in {DatabaseName}");
                }

                // Define Index object on the table by supplying the Table1 as the parent table and the primary key name in the constructor.
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Information, $"Creating {table.Schema}_{table.Name}_PK Primary Key in {DatabaseName}");
                }
                Index pk = new Index(table, $"{table.Schema}_{table.Name}_PK");
                pk.IndexKeyType = IndexKeyType.DriPrimaryKey;

                // Add Col1 as the Index Column
                IndexedColumn idxCol1 = new IndexedColumn(pk, "Script");
                pk.IndexedColumns.Add(idxCol1);

                // Create the Primary Key
                pk.Create();
                if (Logger != null)
                {
                    Logger.Log(LogLevel.Debug, $"Created {table.Schema}_{table.Name}_PK Primary Key in {DatabaseName}");
                }
            }
            if (Logger != null)
            {
                Logger.Log(LogLevel.Information, $"Database {DatabaseName} has been initialized.");
            }
        }
        public static SqlDbType GetSqlDbTypeFromStoredProcedureParameterDataType(Microsoft.SqlServer.Management.Smo.DataType smoType)
        {
            SqlDbType sqlDbType     = SqlDbType.Variant;
            string    smoTypeString = smoType.SqlDataType.ToString();

            switch (smoTypeString)
            {
            case SqlDbConstants.BIGINT:
            {
                sqlDbType = SqlDbType.BigInt;
                break;
            }

            case SqlDbConstants.BINARY:
            {
                sqlDbType = SqlDbType.Binary;
                break;
            }

            case SqlDbConstants.BIT:
            {
                sqlDbType = SqlDbType.Bit;
                break;
            }

            case SqlDbConstants.CHAR:
            {
                sqlDbType = SqlDbType.Char;
                break;
            }

            case SqlDbConstants.DATETIME:
            {
                sqlDbType = SqlDbType.DateTime;
                break;
            }

            case SqlDbConstants.DECIMAL:
            {
                sqlDbType = SqlDbType.Decimal;
                break;
            }

            case SqlDbConstants.FLOAT:
            {
                sqlDbType = SqlDbType.Float;
                break;
            }

            case SqlDbConstants.IMAGE:
            {
                sqlDbType = SqlDbType.Image;
                break;
            }

            case SqlDbConstants.INT:
            {
                sqlDbType = SqlDbType.Int;
                break;
            }

            case SqlDbConstants.MONEY:
            {
                sqlDbType = SqlDbType.Money;
                break;
            }

            case SqlDbConstants.NCHAR:
            {
                sqlDbType = SqlDbType.NChar;
                break;
            }

            case SqlDbConstants.NTEXT:
            {
                sqlDbType = SqlDbType.NText;
                break;
            }

            case SqlDbConstants.NUMERIC:
            {
                sqlDbType = SqlDbType.Decimal;
                break;
            }

            case SqlDbConstants.NVARCHAR:
            {
                sqlDbType = SqlDbType.NVarChar;
                break;
            }

            case SqlDbConstants.REAL:
            {
                sqlDbType = SqlDbType.Real;
                break;
            }

            case SqlDbConstants.SMALLDATETIME:
            {
                sqlDbType = SqlDbType.SmallDateTime;
                break;
            }

            case SqlDbConstants.SMALLINT:
            {
                sqlDbType = SqlDbType.SmallInt;
                break;
            }

            case SqlDbConstants.SMALLMONEY:
            {
                sqlDbType = SqlDbType.SmallMoney;
                break;
            }

            case SqlDbConstants.SQL_VARIANT:
            {
                sqlDbType = SqlDbType.Variant;
                break;
            }

            case SqlDbConstants.TEXT:
            {
                sqlDbType = SqlDbType.Text;
                break;
            }

            case SqlDbConstants.TIMESTAMP:
            {
                sqlDbType = SqlDbType.Timestamp;
                break;
            }

            case SqlDbConstants.TINYINT:
            {
                sqlDbType = SqlDbType.TinyInt;
                break;
            }

            case SqlDbConstants.UNIQUEIDENTIFIER:
            {
                sqlDbType = SqlDbType.UniqueIdentifier;
                break;
            }

            case SqlDbConstants.VARBINARY:
            {
                sqlDbType = SqlDbType.VarBinary;
                break;
            }

            case SqlDbConstants.VARCHAR:
            {
                sqlDbType = SqlDbType.VarChar;
                break;
            }

            case SqlDbConstants.VARIANT:
            {
                sqlDbType = SqlDbType.Variant;
                break;
            }
            }
            return(sqlDbType);
        }
예제 #10
0
 public Col(string name, string typeName, Microsoft.SqlServer.Management.Smo.DataType dataType) {
     this.name = name;
     this.typeName = typeName;
     this.dataType = dataType;
 }