Beispiel #1
0
        protected override void OnShown(EventArgs e)
        {
            PrepareBrowseQuery();

            Requery();

            rdrDataSet.Clear();
            rdrDataAdapter.Fill(rdrDataSet, "Radar");

            dataGridView1.DataSource = rdrDataSet.Tables["Radar"];

            txtFilter.Focus();
        }
        private static DataSet ReadData(string tableName)
        {
            var dataSet = new DataSet();
            var query   = $"SELECT * FROM {tableName}";

            using (var sqlCM = new SqlProxyCommand(query, GlobalInfo.DBaseInfo.dbManager.DB_Connection))
            {
                var sqlDA = new SqlProxyDataAdapter(sqlCM);
                sqlDA.Fill(dataSet, tableName);
            }

            return(dataSet);
        }
Beispiel #3
0
        private SqlProxyDataAdapter CreateDataAdapter(string name, SqlProxyCommand sqlCommand)
        {
            SqlProxyDataAdapter dAdapter = null;

            dAdapter = new SqlProxyDataAdapter(sqlCommand);

            try
            {
                dAdapter.FillSchema(Dataset, SchemaType.Source);
                dAdapter.Fill(Dataset, name);
                SetDefaultValue(name);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }

            return(dAdapter);
        }
Beispiel #4
0
        public virtual bool Find()
        {
            if (dataSet == null)
            {
                dataSet = new DataSet();
                CreateConnection();
            }

            dataSet.Clear();
            SetParameters();
            AddTransaction();
            try
            {
                sqlDA.Fill(dataSet, myTable);
            }
            catch (SqlException e)
            {
                Trace.Write(e.Message);
                Debug.Assert(false);
            }

            return(dataSet.Tables[0].Rows.Count > 0);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var result = GetDBType(typeof(String));

            ProxyProviderLoader.UseProvider = ProviderType.SQL;
            //var list = SqlProxyDatabaseHelper.ListDatabase("USR-ROGLEDIMAU1", "sa", "", true);

            var sqlconnectiostring = new SqlProxyConnectionStringbuilder
            {
                DataSource = @"SALA\SQLEXPRESS",
                //UserID = "sa",
                InitialCatalog = "PLUMBER",
                //Password = "******",
                IntegratedSecurity = true
            };

            //var creadb = new SqlProxyDataBaseHelper
            //{
            //    DataSource = @"C:\Users\Rogledi\Desktop\Clothes.db"
            //};
            //creadb.CreateDatabase();

            //var creadb = new SqlProxyCreateDatabase
            //{
            //    DataSource = "USR-ROGLEDIMAU1",
            //    UserID = "sa",
            //    InitialCatalog = "PROVADB",
            //};
            //creadb.CreateDatabase();

            SqlProxyDatabaseHelper.Password = "******";

            //var sqlconnectiostring = new SqlProxyConnectionStringbuilder
            //{
            //    DataSource = @"USR-ROGLEDIMAU1",
            //    UserID = "sa",
            //    InitialCatalog = "NORTHWIND"
            //};

            //ProxyProviderLoader.UseProvider = ProviderType.SQLite;
            //var sqlconnectiostring = new SqlProxyConnectionStringbuilder
            //{
            //    DataSource = @"D:\Utenti\Mauro\Desktop\Clothes.db"
            //};

            using (var connection = new SqlProxyConnection(sqlconnectiostring.ConnectionString))
            {
                connection.Open();

                {
                    // var transaction = connection.BeginTransaction();
                    var p1 = new SqlProxyParameter("@p1", DbType.String, 16)
                    {
                        Value = "ARDUINO"
                    };

                    //var p1 = new SqlProxyParameter("@p1", DbType.Int16)
                    //{
                    //    Value = 1
                    //};

                    //var p1 = new SqlProxyParameter("@p1", DbType.String, 5)
                    //{
                    //    Value = "ALFKI"
                    //};

                    var dataSet = new DataSet();
                    //using (var sqlCmd = new SqlProxyCommand("SELECT * FROM CUSTOMERS where CustomerID = @p1"))
                    //using (var sqlCmd = new SqlProxyCommand("SELECT * FROM CL_MASTER where ID = @p1", connection))
                    using (var sqlCmd = new SqlProxyCommand(connection))
                    {
                        var p2 = sqlCmd.Parameters.Add(p1);
                        sqlCmd.CommandText = "SELECT * FROM PL_MASTERS where Code = @p1";
                        var dAdapter = new SqlProxyDataAdapter()
                        {
                            SelectCommand = sqlCmd
                        };

                        var cBuilder = new SqlProxyCommandBuilder(dAdapter)
                        {
                            QuotePrefix    = "[",
                            QuoteSuffix    = "]",
                            ConflictOption = ConflictOption.CompareRowVersion
                        };
                        //dAdapter.UpdateCommand = cBuilder.GetUpdateCommand();
                        dAdapter.InsertCommand = cBuilder.GetInsertCommand();
                        //dAdapter.DeleteCommand = cBuilder.GetDeleteCommand();


                        //dAdapter.RowUpdating += DAdapter_RowUpdating;
                        dAdapter.Fill(dataSet, "tablename");
                        var e = new RowUpdatedEventArgs(dataSet.Tables[0].Rows[0], new SqlCommand(), StatementType.Batch, new DataTableMapping());

                        //sqlCmd.Transaction = transaction;
                        //var sqldatareader = sqlCmd.ExecuteReader();
                        //sqldatareader.Read();
                        //var l = sqldatareader[3];
                        //sqldatareader.Close();
                    }

                    //transaction.Commit();
                }

                connection.Close();
            }
        }