Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you are connecting to a SQL server instance on your own (trusted) computer you can use

Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;")

If you have installed SQLEXPRESS then the above connection string is sufficient. Just replace PUBS with the appropriate database name. If you need other strings you can find them here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Does it spin up? Does the Windows Disk Manager (diskmgmt.msc) recognize it as a disk? Does it list any partitions?

Depending on the degree of "crashness", SpinRite might be able to recover something. Hard to say without more information. It's like saying your car crashed and asking us if it can be repaired without showing us the extent of the damage.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What is your problem with it?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How about a global boolean named MinimizeOnClose which is normally set to True. You could set it to False in ExitToolStripMenuItem_Click. Then in Form1_FormClosing you could test for that and determine whether or not to hide or close. Then your menu handler becomes

Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
    MimimizeOnClose = False
    Me.Close()
End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You'll have to give us a context. What are you trying to do? If it involves code then please show us the code.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Blank chat window a few minutes ago.
c2a965eb0ff2c29612f1b562d00c0c2c

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's not what we do. You have to show some effort. If you have specific questions then perhaps we can help with that. Besides, why reinvent the wheel? Windows will index your system for you.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It seems to have corrected itself. I've noticed this from time to time that the jump links time out while the first post links do not.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm having a problem today. I'm trying to get to this thread but I can't get to it (problem loading page). However, when I open the thread by clicking on the summary (to get to the first post), it comes up almost immediately. I had the same problem with this thread

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Home made cinnamon buns. Good to see you back LastMitch.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Cloudy with rain off and on today and last night we had a bitchin' thunderstorm with lots of lightning. It passed within a kilometer. Scared the crap out of the dog but the lights were fantastic.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

While I was building the query (which looks like this)

Dim cmd As New OleDbCommand("", conn)
cmd.CommandText = "UPDATE tblstaff " _
                & "   SET fName=?, lName=?, dob=?, eMail=?,  mobileNo=?, " _
                & "       designation=?, address=?, fAppointment=?,  " _
                & "       fpromotion=?, lpromotion=?, publications=?, " _
                & "       position=?,leaveStatus=? " _
                & " WHERE pfNumber=?"

cmd.Parameters.AddWithValue("@fname ", txtFname.Text)
cmd.Parameters.AddWithValue("@lname ", txtLname.Text)
cmd.Parameters.AddWithValue("@dob   ", dtpDob.Value)
cmd.Parameters.AddWithValue("@email ", txtEmail.Text)
cmd.Parameters.AddWithValue("@mobile", txtPno.Text)
cmd.Parameters.AddWithValue("@desig ", txtDesignat.Text)
cmd.Parameters.AddWithValue("@addr  ", txtAddress.Text)
cmd.Parameters.AddWithValue("@fappt ", dtpFappoint.Value)
cmd.Parameters.AddWithValue("@fpromo", dtpFpromo.Value)
cmd.Parameters.AddWithValue("@lpromo", dtpLpromo.Value)
cmd.Parameters.AddWithValue("@pubs  ", txtPublicatn.Text)
cmd.Parameters.AddWithValue("@posn  ", txtPosition.Text)
cmd.Parameters.AddWithValue("@leave ", txtLstatus.Text)
cmd.Parameters.AddWithValue("@pfno  ", txtPfNo.Text)

I noticed that your query was trying to format txtPfNo.Text into the first parameter which is fName='{1}'. That is definitely a problem because none of the parameters line up. Note that when using parameterized queries with SqlClient (which you are not), the "@names" can be added in any order. When using it with OleDb (which is what you would use), the AddWithValue calls must be made in the same order in which the "?" parameters appear in your query.

I cannot actually test this query because I do not have Access installed.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

DDL is the data definition language, or the command that you execute to create the table. An example of the DDL is

CREATE TABLE [dbo].[PDFStore](
    [FileName] [varchar](500) NOT NULL,
    [Contents] [varbinary](max) NULL,
 CONSTRAINT [PK_PDFStore] PRIMARY KEY CLUSTERED 
(
    [FileName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

In order to display the data in a listview you have to set it to view details (columnar data)

ListView1.View = View.Details

Normally this would be done at design time. I'm assuming you have already done this. In order to display all of the records returned from the query you will need a loop. An example is

Dim dr As SqlDataReader = sqlcmd.ExecuteReader

Do While dr.Read()
    ListView1.Items.Add(New ListViewItem({rdr("Item"), rdr("Description"), rdr("Quantity"), rdr("Amount")}))
Loop
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'll put together a parameterized query for you (it's raining all day and I'm bored) but in the meantime I want you to post the structure of your table so I can see the declared type of each field.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The only reason the US wants to take Military action is to nuke the hell out of Syria,

There are no profits to be made by nuking Syria. The arms manufacturers get far more money if they send in a few rounds of cruise missiles and start a military occupation that drags on for years like Iraq and Afghanistan. The companies like Haliburton can make billions from government contracts to provide security and infrastructure. As Al Pacino said in The Godfather, "It's not personal. It's business."

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think the format for a date in Access queries is #07/05/2013. As for the other fields, the numeric fields should not have single quotes. If the field mobileNo is defined as a numeric then it should not have single quotes. If it is defined as a string (judging by the leading zero I'm assuming it is) then your query string then becomes

UPDATE tblstaff 
   SET fName='Trues', 
       lName='Jethro', 
       dob=#30/12/1988#, 
       eMail='enemali@yahoo.com', 
       mobileNo='08145450902', 
       designation='Graduate Assistant', 
       address='No.23 Inikpi street,High Level', 
       fAppointment=#29/06/2012#, 
       fpromotion=#02/02/2013#, 
       lpromotion=#07/05/2013#, 
       publications='Journal on finger print identification system,Microcontroller configuration.', 
       position='Assistant HOD', 
       leaveStatus='Study leave fo two years' 
       WHERE pfNumber='PF/2664'

and your builder becomes

Dim sql As String = String.Format(" _
    "UPDATE tblstaff " _
    "   SET fName='{1}',lName='{2}', dob=#{3}#, eMail='{4}', " _
    "    mobileNo='{5}', designation='{6}', address='{7}', " _
    "    fAppointment=#{8}#, fpromotion=#{9}#, lpromotion=#{10}#, " _
    "    publications='{11}', position='{12}', leaveStatus='{13}' " _
    WHERE pfNumber='{0}'", _

    etc.

but you would be better off using parameterized queries. There is an example using OleDb here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why don't you just wait until you actually start the job with Samsung before you go job hopping?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try changing

[Fen_Inovoice_No]='" & TextBox1.Text & "'"

to

[Fen_Inovoice_No]=" & TextBox1.Text

Without seeing your DDL I suspect that Fen_Inovoice_No is being stored as a number, in which case you do not need the single quotes.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You don't have to add anything on your system. You use your browser to browse to whatever forum interests you. If you want to go to the chat area just click Chat at the right side of the purple ribbon at the bottom of the browser display (note - you may have to scroll to the bottom to see it depending on your screen resolution).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

But I'm not bitter.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Incidentally, if the US does intervene, I expect the first consequence will be an immediate rise in the price of gasoline due to "uncertainty" in the supply of mideast oil. It will be immediate in spite of the claim by the oil companies that it takes three months for oil to work through the system (the justification for why prices at the pump do not drop immediately in response to a drop in the price of crude).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's pretty vague. Can you elaborate?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That is against the daniweb rules. The first rule states

Do ensure you own the intellectual property rights to everything that you post

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If the US wants a military action they will have their military action. If they don't have evidence then they'll just make [stuff] up like they did with the Gulf of Tonkin in Viet Nam and the baby-killers in the Gulf War.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'll check it out. Thanks for the link.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think that with the use of gas on his own people was crossing a Rubicon.

Has there been any definitive proof that shows which side was responsible for the use of the chemical weapons?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't understand what you mean by FileTables. I know what a file is, and what a table is, but not a FileTable. Yes, my example requires the PDF to be in a file, however, it may be possible to create that file in memory rather than to disk. I'm not particularly interested in researching this so feel free, however, in the absence of a memory-based file you could always use the %TEMP% folder for such an operation.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As soon as the news broke about the use of chemical weapons, Washington started demanding that UN inspectors be allowed in. Assad gave the official nod to the inspectors, then Washington stated that the inspections were pointless because Assad's consent was "too late to be credible". This in spite of statements by experts that chemical agents used in weaponry take years to dissipate. In one case, sarin was detected four years after it was used in Northern Iraq. It would seem that Washington made these demands expecting them to be refused, thereby using the refusal as an excuse for military action.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I tried this in my SQL Management console query window and it worked.

UPDATE PDFStore
   SET Contents = (SELECT  * FROM OPENROWSET(BULK 'D:\test.pdf', SINGLE_BLOB) SOMEALIAS)
WHERE FileName = 'D:\test.pdf'
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A supposed debate on CNN about what the US should do about Syria showed how "fair and balanced" the media is being. One side advocated bombing now while the opposing viewpoint was "we should have started bombing long ago". I'm reminded of the Bugs Bunny, Daffy Duck, Elmer Fudd cartoon. "Do you want to shoot him now or wait until you get home?"

<edit>The debate was on Aug 27</edit>

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Using paramaterized queries your insert build becomes

cmd.CommandText = "INSERT INTO Mobilization (Fen_Telephone_No, Fen_Inovoice_No," _
                & "    Fen_VAT_No, [Date], Fen_Fax_No, Source_of_order, Totalamount," _
                & "    NBT_Value, NBT_Amount, VAT_Value, VAT_Amount, Grand_total," _
                & "    Contract_Name, Client_Name, Moblization_Value,Moblization_Percentage) " _
                & "VALUES(@Fen_Telephone_No, @Fen_Inovoice_No, @Fen_VAT_No, @Date," _
                & "       @Fen_Fax_No, @Source_of_order, @Totalamount, @NBT_Value," _
                & "       @NBT_Amount, @VAT_Value, @VAT_Amount, @Grand_total, @Contract_Name," _
                & "       @Client_Name, @Moblization_Value, @Moblization_Percentage"

cmd.Parameters.AddWithValue("@Fen_Telephone_No      ", textbox1.Text)
cmd.Parameters.AddWithValue("@Fen_Inovoice_No       ", textbox2.Text)
cmd.Parameters.AddWithValue("@Fen_VAT_No            ", textbox3.Text)
cmd.Parameters.AddWithValue("@Date                  ", textbox4.Text)
cmd.Parameters.AddWithValue("@Fen_Fax_No            ", textbox5.Text)
cmd.Parameters.AddWithValue("@Source_of_order       ", textbox6.Text)
cmd.Parameters.AddWithValue("@Totalamount           ", textbox7.Text)
cmd.Parameters.AddWithValue("@NBT_Value             ", textbox8.Text)
cmd.Parameters.AddWithValue("@NBT_Amount            ", textbox9.Text)
cmd.Parameters.AddWithValue("@VAT_Value             ", textbox10.Text)
cmd.Parameters.AddWithValue("@VAT_Amount            ", textbox11.Text)
cmd.Parameters.AddWithValue("@Grand_total           ", textbox12.Text)
cmd.Parameters.AddWithValue("@Contract_Name         ", textbox13.Text)
cmd.Parameters.AddWithValue("@Client_Name           ", textbox14.Text)
cmd.Parameters.AddWithValue("@Moblization_Value     ", textbox15.Text)
cmd.Parameters.AddWithValue("@Moblization_Percentage", textbox17.Text)

This not only makes it easier to match textboxes to specific fields but it automatically adds single quotes around fields that require quoting. Note that I replaced "Date" in the query with "[Date]" to prevent a conflict with a SQL reserved word. You can modify your update query accordingly.

You also might have a typo in the field name Fen_Inovoice_No. I suspect you want Fen_Invoice_No

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's not a complicated thing and it does not require databinding. If your teacher says it is a complicated thing then I suggest you take everything he/she says with a grain of salt.

Because this is an assignment I will not give you the code but here is a hint. Every time someone makes a change to the text in the textbox you want to change the label to be the same as the textbox. So you have an event that you want to respond to. It only requires you to write one line of code. Let me know if that helps.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

We can't tell you what is wrong with your query unless you show us what the query looks like. It's likely a problem with a missing, superfluous, or mismatched single quote. You should rewrite your code to use parameterized queries. This will make the code easier to read and debug.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That error message is from the DBMS when you try to execute the query. I need to the see the value of sql before you execute the query. Posting the error message alone is as useful as saying "what is wrong with my code" without posting the code for us to see.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Does anyone recall the movie, Reds? Jack Reid is asked to give a speach on why the US is getting involved in World War 1. He stands up, says "Profits", then sits down. In the 1950s Eisenhower warned about the power of the military industrial complex. Very telling in the above article was the comment President Obama's decision-making will be guided by what is in the best interests of the United States. Note, it is not what is in the best interests of the Syrian people.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You don't need to use SqlFileStream to store a PDF (or any binary file) into a database. See the example here

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You posted

 cmd.CommandText = "UPDATE Sales " & _
    " SET Order_Id=" & OrdID.Text & _
    ",    Order_Category='" & OrdCat.Text & "'" & _
    ",    Order_Date='" & CStr(OrdDate.Text) & "'" & _
    ",    Order_Rate='" & OrdRte.Text & "'" & _
    ",    Order_Quantity='" & OrdQty.Text & "'" & _
    ",    Order_Amount='" & OrdAmt.Text & "'" & _
    "  WHERE Order_Id='" & OrdID.Tag

Pritaeas asked you to post the value of cmd.CommandText. You are creating a SQL query by combining static text (literals) with dynamic text (textboxes). That query is then passed to the DBMS. In order to debug your query we have to see the actual query that is passed to the DBMS. So add the following line of code

Debug.WriteLine(cmd.CommandText)

and post the results here. Once you have the correct query we can show you how to do the same query using parameters. Using parameterized queries has several advantages. It

  • helps avoid SQL injection attacks
  • frees you from having to worry about when to use single quotes
  • automatically corrects parameters that have embedded quotes
  • makes the code easier to read and debug
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I agree with AD. Having said that, I fully believe that the US will take military action. There's too much money to be made to stay out. If it's not Syria then it will be Iran. Have you noticed the same weasel words being used by Obama that Bush used when prepping for Iraq? The justification is not "Syria has done x", but rather "We believe Syria has done x". "We believe Iraq has WMDs". Sound familiar? And if, later, it turns out that there was no justification they'll just blame it on faulty intelligence.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have to add a handler to populate listbox2 with new data when you select an item in listbox1

Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    Dim lbx As ListBox = sender
    MsgBox("You selected " & lbx.SelectedItem)

    'add your code to clear and populate listbox2 here

End Sub
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you aren't going to read what we post then we can't help you. pritaeas told you what to output.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Please add the following line after the creation of the string sql

Debug.WriteLine(sql)

And post the result here. In order to tell you what is wrong with the query we have to see the query. To avoid SQL injection attacks you should be using parameterized queries

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You haven't included your code for a handler for ListBox1 for a change in selection.

Why do you need a timer to repeatedly get a static value?

You should rename your controls so that the code is clearer.

You should add comments.

You have handlers for two buttons but I only see one on the form.

From now on please upload associated images to Daniweb. If you place them elsewhere and they eventually disappear then this thread loses information that makes it useful to others.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

We have to see the query before we can tell you what is wrong with it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Call
On
Many
People
Everywhere
To
Invest
Time
In
Organized
Nimbleness

Automobile

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Move all the messages in your gmail inbox into a new gmail folder that you create.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Hard to say without knowing your database definitions, what your DBMS is and looking at this app in the debugger to get variable values, but I have two alternate suggestions:

  1. Delete and recreate the database tables you want to override. The SQL query to do delete a table is

    DROP TABLE tablename

  2. Delete all the data in the tables you want to override. The SQL query to do this is

    TRUNCATE TABLE tablename

I suspect it would be better to TRUNCATE rather than DROP.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Jim if that was a poke at mine for Herioc, did I use Integument incorrectly

That was not a poke at you. But

Harpoon - Hello: Anthony, Ryan, Paul, Owen, Omar, Nathan..

showed no effort whatsoever.

<M/> commented: sorry :D +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That would be true if OrdID is a non-numeric field. It is probably numeric and does not require single quotes. But I can't say for sure without seeing the table definition.

 cmd.CommandText = "UPDATE Sales " & _
    " SET Order_Id=" & OrdID.Text & _
    ", Order_Category='" & OrdCat.Text & "'" & _
    ", Order_Date='" & CStr(OrdDate.Text) & "'" & _
    ", Order_Rate=" & OrdRte.Text & _
    ", Order_Quantity=" & OrdQty.Text & _
    ", Order_Amount=" & OrdAmt.Text & _
    " WHERE Order_Id=" & OrdID.Tag

Would be more appropriate. We still need to see the actual query string. And, of course, parameterized queries should be used.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can we at least attempt to make the acronym expansion more than just words with the correct initial letter? I think the previous explanation for Mississippi is quite clever but there have been a couple that looked like they were words picked at random out of the dictionary. If the expansion is also related to the acronym then bonus points to you. As for the ultra epic, etc. challenge, I fear it is beyond me.

<M/> commented: sure why not +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Heroic
Olympic
Canucks
Kill
Event.
Yahoo

Survivor