|
Yeah, I saw a bunch of things wrong with it, but only pointed out a couple of issues. Since he's bent on writing bad code and practicing bad habits, why bother saying anything...
|
|
|
|
|
Having seen all your recent posts, why not try buying a book and using that? These are very simple, basic questions you are asking and it seems as if you have no real idea what you are doing.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I already have many books , but the information is very confusing
please suggest a good one for begginners like me?
|
|
|
|
|
If you wanted to be really lazy, you could use the My.Computer.FileSystem methods as well.
Check this. Get you pointed in the right direction with the basics.
You could always search code sites for tutorials (ahem, CodeProject anyone?) or press F1 and search the MSDN library. For most topics, its really not that hard to find examples in the MSDN with minimal searching.
Is it beer thirty yet?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I have no idea what book would be suitable for a beginner as I haven't looked at that level f information for many years, but there are hundreds to choose from. Go to a good book shop or Amazon and browse a few until you find one you can understand. In the meantime, press F1 for help or use google, there are thousands of examples and code snippets out there, it just takes a little initiative to look for yourself rather than expecting other people to do your research for you.
I just had a quick look on Amazon and thsi sounds about your level:
Microsoft Visual Basic.NET Programming for the Absolute Beginner (Absolute Beginners) (Paperback)
by Jonathan Harbour
If that one is too complex then change career, t can't be much simpler than this.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Ashfield wrote:
If that one is too complex then change career, t can't be much simpler than this.
Honesty is the best policy. I think people who attempt to pick up programming for the first time tend to pick projects that are nearly impossible to start with. Start with the basics and then move on.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hey all, I've been working with making a client to insert / delete ect. from a database, and I can't get text fields to insert values into a database for some strange reason.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Dim sqlconn As New SqlClient.SqlConnection
sqlconn.ConnectionString = "Server=[removed];Database=erik_asp;Uid=asp;Pwd=[removed for security purposes];"
Try
sqlconn.Open()
Catch ex As Exception
MsgBox("Could not connect!", MsgBoxStyle.Critical, "Connection Error!")
End Try
If sqlconn.State = 1 Then
Dim sqlconnecter As New SqlCommand( _
"INSERT INTO [Team] ([position], [name], [email]) VALUES (" & positionbx.Text & ", " & usernamebx.Text & ", " & emailbx.Text & "))", sqlconn)
sqlconnecter.ExecuteNonQuery()
sqlconn.Close()
End If
End Sub
It returns this error:
The name 'blahblahblahtext' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
This happens with all the text boxes.
Please note I am able to easily connect and view current data in the grid, I just can't insert this data and it's starting to irritate me.
|
|
|
|
|
Hi,
1.
when presenting string literals SQL expects them to be in quotes (so they can include keywords, spaces, some special symbols, etc. without confusing the SQL parser).
2.
your code is vulnerable to "SQL injection" where the user could make your command do entirely different things simply by entering well chosen text into your textboxes. Use parameterized queries instead.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Can you explain to me how to fix this if you would? I am newer at using databases in Visual Basic, and I have experience in PHP (not much though) and SQL injection on MySQL databases, but MS SQL is different for me. I am not too worried about other users having this because I am the only one that will have this, I'm programming it for my convenience down the road.
|
|
|
|
|
AFAIK the same is true for PHP+MySQL, you need single quotes (be careful not to include extraneous spaces!)
Example:
...VALUES (" & positionbx.Text & ", " & usernamebx.Text & ", ... should be changed to
...VALUES ('" & positionbx.Text & "', '" & usernamebx.Text & "', ...
When in doubt, print the final SQL statement (e.g. using Console.WriteLine) so you can have a real look.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks! Got it to work. Uhh, what about deleting the current selected one, or making a list box with the contents? Perhaps deleting by ID?
|
|
|
|
|
Unless there is a serious need and reason to do otherwise, you should delete by ID.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
When using ShowPopup() method in vb 2005 professional edition application , to display Arabic text Popup window , at run time we get the text displayed in incorrect characters. what can i do to solve this problem .
does the Popup Window in vb 2005 support Arabic language ?
Please help me .
modified on Thursday, June 4, 2009 10:34 AM
|
|
|
|
|
What is ShowPopup ? Is this a web question or is this is nasty VB shortcut to an actual .NET method ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
It ain't a VB shortcut. It's got to be something on the JavaScript side.
|
|
|
|
|
I thought so, but google gave me nothing, so.....
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Maybe you should try Google again. Top of the search results list for ShowPopup it gave me this:
http://msdn.microsoft.com/en-us/library/system.windows.forms.help.showpopup.aspx[^]
which is exactly what the OP is asking about in the subject line of his post. Microsoft seem to think it's a .NET method, and I guess they should know.
Unfortunately, I can't help with the original question about Arabic characters since I've never done any RTL stuff.
|
|
|
|
|
Weird. I searched VB.NET ShowPopup and got nothing. I take solace in the fact that Dave had never heard of it either.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
No, I haven't. I don't even use the Help class. And from the OP's description, it didn't look like he was either. It looked more like a description of a problem with showing a normal window.
|
|
|
|
|
I have this program below when i click this the text in textbox1 should replace the value of x
as a command line variable but this isn't happening.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As String
x = TextBox1.Text
Shell("un.cmd x", AppWinStyle.NormalFocus, False)
End Sub
Any help would be great.
please respond asap.
thanks.
|
|
|
|
|
Try this:
Shell("un.cmd " & x, AppWinStyle.NormalFocus, False)
|
|
|
|
|
I says "file not found" while debugging, and crashes.
|
|
|
|
|
Sorry,
I first wrote this:
Shell("un.cmd" & x, AppWinStyle.NormalFocus, False)
Then edited my comment to this (with a space after un.cmd ):
Shell("un.cmd " & x, AppWinStyle.NormalFocus, False)
Try the one with the space.
You were putting your variable in your code as a string, not the variable name.
|
|
|
|
|
Thanks that worked but when my variable i.e text in the textbox1 contains spaces only first word is shown.
this is what i want to actually do.
@echo off
7zr a -mx9 "%1".7z "%1".ecm
pause
this is a batch program to create archives of any file give as first argument to it.
now what i want to do is that i want do the same using vb so that i don't need an extra batch program.
Can you please tell me how to doing by replacing the varibles %1 as variable x
something like this
dim x as string
x = textbox1.text
shell("7zr a -mx9 "x".7z "x".ecm")
thanks.
|
|
|
|
|
If your file name has spaces in it, I believe you have to surround the filename with double quotes. You'd want something like this:
Shell("7zr a -mx9 " & """" & x & ".7z" & """" & " " & """" & x & ".ecm")
|
|
|
|