|
Hi, I'm trying to dynamically build an insert query.
Dim strIns as string = "Insert into XXXX (Field01, Field02) values( '{0}', {1})"
Dim strVals as string = ""Value00","value01""
Dim strWork as string = String.Format(strIns,strVals)
This results in an error
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Could anyone please point me into the right direction?
Thanks
|
|
|
|
|
{0}, {1} means you need to pass two arguments besides strIns
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thanks Christian,
The arguments are supposed to be in the strVals that is being passed.
From your reply I gather that I need to pass the individual arguments rather than building a string with the values to pass.
regards,
|
|
|
|
|
Correct.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Somebody can tell me( teach me ) how can i program an editable listview?
I want to hve a listview that can be editable in any subitem.
Now i can only edit the item...
the code to edit the item is...
Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
Me.ListView1.LabelEdit() = True
Me.ListView1.SelectedItems(0).BeginEdit()
End Sub
Please i need help...
By the way my english is bad (I speak portuguese ) so forgive me if made a mistake ...
thanks
Just learning
|
|
|
|
|
ROC_Jnr wrote: Me.ListView1.SelectedItems(0).BeginEdit()
Me.ListView1.SelectedItems(0).SubItems(1).BeginEdit()
I think, I NEVER (amlost) allow inline editing in grid or listviews. I make the user double click to open a form to CRUD a record, that way you are only managing 1 record at a time.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
What do you mean by CRUD?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Nice acronym
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Not mine obviously but I'm happy to use it.
So what do you do all day, oh push CRUD around the screen.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I figured it was an industry standard acronym.
Mycroft Holmes wrote: So what do you do all day, oh push CRUD around the screen.
So true
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I have to update some 2002 code. This import does not seem to be valid anymore. Anyone know what happened to this?
Imports System.Runtime.Serialization.Formatters.Soap
TIA
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
modified on Monday, August 11, 2008 8:46 AM
|
|
|
|
|
hi Rafone
Be more Specific, what is your Problem.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I assume he means that this API call is no longer valid or has been moved to a different namespace/class?
Kevin
|
|
|
|
|
Did you include the proper references in your project?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
You have to add a reference to it in the Project's properties. [Whoops, someone already said that.]
|
|
|
|
|
Thanks to all.
It appears to me that this namespace has been replaced with
System.Runtime.Serialization.Formatters.XML
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hi all,
I have to develop a project, which will have ListView control along with expand and minimize button features. In other words, I need to attach 5 tables in single form which will show only header when clicked on the header, expanded table to be shown. can anyone help me to achieve this.
I am using arrays as input data to tables
|
|
|
|
|
2 controls and an image button.
1 Textbox/label to hold the table name and info
Listview (I like listviews) with a height of 0
When the use clicks the image button, change the image and expand the height of the listview.
Experiment with a user control (all 3 controls in a panel) stick the UC inside a flowcontrol and it may manage the control actions when you expand/contract the listview. Remember if you use a UC put the management in th code behind the UC.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ask u guys..i need to differentiate the codes between color of maps in day and night..in vb 2008
|
|
|
|
|
What are you asking for ? To color maps where, and based on what ? You want to draw what regions are night and which are day ? Just draw a semi transparent black box over the night part of your map.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hy everyone!
i am looking for good ideas. what i want to do is to realize a file/directorywatcher, which handles xml files and when it is done it places a "finished" file into this directory to indicate the file was handled.
example: i do have 5 directories (a, b, c, d and e) which contain different xml files. only one in each folder. when my program has handled a file in one folder, it places a "finished" file in there. sounds easy
well my problem is, i found out if it takes to long to handle a file and the other proggy (which creates the xml files) finds a "finished" file, then it starts to consume these files and folders. this means when one "finished" file is found then it deletes all folders one by one. and if my program isn't quick enough, files are lost.
that's why i tried to figure out a different solution to this problem. i have to add the "finished" files to the directories after having handled tue last xml file, which was found.
well therefore i have to remember the directories, i parsed before.
i thought about using a string similar to csv e.g. "dir1;dir2;...", split it afterwards and add the file. or to create an array adding one element after each other. but both solutions could become very timeconsuming. the bigger the string will get, the longer it will take to rewrite it (no idea if there is a function like stringbuilder in c#). and rewriting an array to add an element isn't nice neither.
does anyone of you have a good idea how to handle it? i also thought about creating a temp "finished" file and rename it afterwards, but i will have to remeber the directories as well to do so.
so to summarize the situation is like this:
1) read xml files from different directories and handle them (one by one - read one dir, handle xml file, next dir etc.)
2) when all xml files are handled which where found in the directories, then write a "finished" file in each directory to indicate the operation was finished
3) start at 1) again whit the next files
it's allowed to have
dirA finished
dirB finished
....
dirZ finished
but it's not allowed to have
dirA finished
dirB finished
.....
dirX file.xml
dirZ file.xml
my old solutions was quite easy: reading the file and write a "finished" file to this directory, then continue with the next one etc. with this solution no storage of directories was needed, but this didn't work properly enough
thanks for any good ideas!
stephan.
|
|
|
|
|
We had a similar problem using a "hot" folder, the enterprise ETL tool would write the files and out local tool (custom written ETL) would get a locked exception when trying to read the file while it is still being written.
Simply implemented a delay loop into our ETL. First time it sees the file during a processing period (18 hours NOT based on date) it sets a time flag. ETL will then ignore the file until the delay period has expired. As the delay is a setting we can vary it if there are still clashes, it is currently set on 120 seconds.
I think your issues is a management problem, are the next set of files (5) the same name as the first set (very nasty) or are there discreet sets of 5 files all the same name going into the different folders 9you only have to manage the file names and a count of folders processed per file name).
Create a table with filename and either a folder count or a time for each folder if more detail is required. Stick the filename in there the first time the file arrives with the folder details if required, keep going till filled (count = 5 or each folder col has a time) Write the file to a log. Flush the table every period with incomplete loads.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Could you try something like this:
Read each xml file one by one, and as each file is handled, write a "handled" file in the directory. Once ALL xml files are handled, rename the "handled" files to "finished" files.
Hope this helps.
Roy.
Roy.
|
|
|
|
|
OK, I cannot find any VB samples, (different issue if I was doing things in C#). Any way, I am using WebClient class and am successfully reading the XML file of business videos in my xaml.vb file asynchronously. But I am having a problem populating the datagrid properly:
<videos>
<profession name="lawyer">
<video id="1" title="Lawyer Title 1" />
<video id="2" title="Lawyer Title 2" />
</profession>
<profession name="doctor">
<video id="1" title="Doctor Title 1" />
<video id="2" title="Doctor Title 2" />
</profession>
</videos>
Here's my query
Dim BizVideos = _
From videos In xmlVideos.DescendantsAndSelf("profession") _
Where videos.Attribute("name") = "doctor" _
Select videos
dgridVideoList.ItemsSource = BizVideos
Here's the problem I am experiencing:
1. I am only getting one row in the datadrid with everything included in that one row, as opposed to what I want, i.e. one row for Video ID 1, and one for Video ID 2.
2. I am getting more fields in the datagrid than I want, i.e. "Has Elements", "Has Attributes", "Parent Node", etc.
Can anyone offer me (a.) the correct syntax for the query where I can break out the video child nodes under profession doctor and diplay them one video per row (b.) avoid showing superflulous fields like "Has Attributes", "Parent Node", etc., as well as (c.) what I am doing wrong in the binding of my datagrid?
Thank you all for your help.
|
|
|
|