
Joe Mamma
Avatar/Signature-
Posts
1093 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Joe Mamma
-
Retrieving images from SQL Server
Joe Mamma replied to VBAHole22's topic in Database / XML / Reporting
I see the problem. . . you arent saving an image into sql server, you are saving an embedded OLE object. note when you link a table to an access mdf, images are mapped as OLE Objects. we use DBPix for our VB6/VBA apps. In delphi this isn't a problem as it ships with native bound image controls. :( sorry. -
Retrieving images from SQL Server
Joe Mamma replied to VBAHole22's topic in Database / XML / Reporting
the question is. . . are you sure you hacve images in the database and that access didnt corrupt them??? -
Retrieving images from SQL Server
Joe Mamma replied to VBAHole22's topic in Database / XML / Reporting
Im thinking you might want to convert your access mdb to an adp and connect via ado to the sql server there are lots of bugs with the ODBC sql server driver. . . I know that text/ntext fields can get truncated -
if we are playing the game 'fastest and shortest' private void ClearTextBoxes(Control parent) { foreach (Control ctrl in parent.Controls) ClearTextBoxes(ctrl); if (parent is TextBox) parent.Text = string.Empty; }
-
so what happens if someone types in - THIS IS NOT AN NUMBER
-
well that begs the question. . . if the barcode has a character in it why is he saving it as an int? why is it an int in the database? make it a string/varchar. use a parameterized query. forget all this nonsense. K.I.S.S.
-
question. . . what do you think will happen if someone types in your text box the following string - 1;drop table tablename; and presses enter
-
Deleting all records in a table
Joe Mamma replied to csharp_boy's topic in Database / XML / Reporting
note. . . this will populate the log and could impede performance. In sql server you have the "truncate" statement. in other databases, there is probably a similar statement just an fyi -
Return all records from JOINed tables
Joe Mamma replied to Rattlesnake's topic in Database / XML / Reporting
depending on performance, either of these should work - Select sf.CustomerID, sf. ProductID, sf.ForecastMonth TheMonth, sf.ForecastYear TheYear ,Sum(sf.ForecastQuantity) as TotalFC, Sum(sf.OrderQuantity) TotalOrders From SalesForecast sf left join SalesOrder so on sf.CustomerID = so.CustomerID and sf.ProductID = sf.ProductID and sf.ForecastMonth = so.OrderMonth and sf.ForecastYear = so.OrderYear GROUPBY sf.CustomerID,sf.ProductID, so.ForecastMonth,so.ForecastYear union Select so.CustomerID, so. ProductID, so.OrderMonth , so.OrderYear , sum(0) , Sum(OrderQuantity) TotalOrders From SalesOrder so left join SalesForecast sf so.CustomerID = so.CustomerID and so.ProductID = sf.ProductID and so.OrderMonth = sf.ForecastMonth and so.OrderYear = sf.ForecastYear where sf.CustomerId is null GROUPBY so.CustomerID,sof.ProductID, so.OrderMonth, so.OrderYear or select CustomerID, ProductID, TheMonth, TheYear, sum(ForecastQuantity) TotalForcast, sum(OrderQuantity) TotalOrder from ( Select CustomerID, ProductID, ForecastMonth TheMonth, ForecastYear TheYear, ForecastQuantity, 0 OrderQuantity from SalesForecast union Select CustomerID, ProductID, OrderMonth , OrderYear, 0 ForecastQuantity, OrderQuantity from SalesOrder ) temp group by CustomerID, ProductID, TheMonth, TheYear -
If a listbox.Datasource is bound to an object, you don't manipulate the listbox items directly, add the items to whatever object the listbox.Datasource is bound to.
-
Populating HashTable with a DataTable
Joe Mamma replied to rcaine's topic in Database / XML / Reporting
Are trying to associate a key value with a datatable row? Like: MyHash[Key1] = MyDataTable[1]; MyHash[Key2] = MyDataTable[2]; MyHash[Key3] = MyDataTable[3]; I would ask, what are Key1, Key2, Key3? Where are they coming from? another Datatable? if so, get the table in the same dataset and build a relationship between the two. -
I think this is a matter of security settings, isn't it? The AxWebBrowser wraps up shdocvw.dll and because the word document is activex content, you get this message. I could be wrong as to the exact nature of the url that triggers the message, but this is the source.
-
What does it take to create a collection for a DataGridView?
Joe Mamma replied to Denaes's topic in Windows Forms
Take a look at the BindingList generic -
my example assumes comma delimited
-
as plaus said, you need to do this. A delimited set of values in one field fails to satisfy first normal form - in this thread is a SQL split function after executing the script to create the function you can do the following - given a table like this OriginalTable Key (int), Description (varchar(255)), DELIMITEDFIELD (varchar(8000)) execute this sql script - ' you can execute this entire script in one DBCommand.ExecuteNonQuery call declare @key int declare @DELIMITEDFIELD int create table DELIMITEDFIELDTABLE( originalKey (ID) references OriginalTable(Key), order int, value varchar(255), primary key (originalKey, order) declare curs for select key, DELIMITEDFIELD from OriginalTable open curs fetch next from curs into @key, @DELIMITEDFIELD while @@fetch_status = 0 begin insert into DELIMITEDFIELDTABLE (originalKey, order, value) select @KEY, ID, VALUE from dbo.split(@DELIMITEDFIELD, ',') fetch next from curs into @key, @DELIMITEDFIELD end close curs deallocate curs alter table OriginalTable drop column DELIMITEDFIELD
-
You may want to consider something like this - namespace KeyedQueuedCommand { public abstract class QueuedCommand { KeyedQueue _queue; public QueuedCommand(KeyedQueue queue) { _queue = queue; _queue.Enqueue(this); } protected abstract void OnExecute(); public void Execute() { this.OnExecute(); _queue.Dequeue(); } } public class KeyedQueue:Queue { static Hashtable _hash; object _key; static KeyedQueue() { _hash = new Hashtable(); } private KeyedQueue(object key) { _key = key; _hash[key] = this; } static public KeyedQueue GetKeyedQueue(object key) { lock(_hash) { if (_hash[key] == null) new KeyedQueue(key); } return _hash[key] as KeyedQueue; } public override object Dequeue() { object result = base.Dequeue(); Console.WriteLine("Object dequeud from Queue {0}\n{1} Object(s) remaining", _key.ToString(), this.Count.ToString()); if (this.Count == 0) { _hash.Remove(_key); Console.WriteLine("{0} queue removed", _key.ToString()); } return result; } public static void Test() { int i = 0; foreach(object key in _hash.Keys) { KeyedQueue q = _hash[key] as KeyedQueue; if ( q != null) i += q.Count; } Console.WriteLine("Test - {0} commands left to execute", i.ToString()); } } } example usage: public class DateCommand: KeyedQueuedCommand.QueuedCommand { public DateCommand(KeyedQueuedCommand.KeyedQueue queue):base(queue){} protected override void OnExecute() { Console.WriteLine("Executed @ {0}", DateTime.Now.ToLongTimeString()); } } private void button1_Click(object sender, System.EventArgs e) { Random rand = new Random(); ArrayList commandlist = new ArrayList(); for (int i = 0; i < 100; i++) { commandlist.Add(new DateCommand( KeyedQueuedCommand.KeyedQueue.GetKeyedQueue(Math.Round(10 * rand.NextDouble())))); } foreach(KeyedQueuedCommand.QueuedCommand cmd in commandlist) cmd.Execute(); KeyedQueuedCommand.KeyedQueue.Test(); }
-
create a class to wrap your data - MyDataClass . declare a BindingList(MyDataClass) - MyBindingList load MyBindingList with instances of your class Set the DataSource of the grid to MyBindingList
-
sqlparametercollection as function argument
Joe Mamma replied to lamy's topic in Database / XML / Reporting
here is how. . . uses oracle, but the same thing. . . look at the last post This is Net 2.0 In 1.x ParamDictionary would inherit from a hashtable http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=185380&SiteID=1 -
umm. .. are you using that bassackwards approach of loading the grid manually (like the morons at xtremeVBtalk suggest you use the flexgrids) or are you binding your collection to it?
-
ahh. . . Im a moron. . yeah I can add it. . . but it comes back out as the size specified by the Imagelist. that sux.
-
I can do it in 1.1 too.
-
I can add a 1024x768 to an imagelist in 2.0. is this a limitation to 1.1?
-
by the way. . . are you in 1.1 or 2.0?