
Microsoft Visual Basic MVP (2010/11, 2011/12, 2012/2013)
The opinions expressed here are my own and are not necessarily those of my employer, partners, customers, friends, family, or pet dog.
All content is presented AS-IS, with ABSOLUTELY NO WARRANTY expressed or implied.
December 15, 2010 at 12:07 am
Welcome to my guest book!
December 15, 2010 at 7:37 am
thanks
January 1, 2011 at 8:25 pm
he he
July 3, 2011 at 11:56 am
Hey Pradeep,
I need a solution to a problem and I guess you’ll be able to crack it. Any help is appreciated.
I get this error when I run my VB Program.
“The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.”
•What my program should do is
1) User inputs text into a text box and hits the search button.
2) Result is populated into the GridView (Access database is being used). Result being – Contains the entered term in a string.
Code:
Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Dim dtATG As New DataTable() ‘ Create New Datatable
dbDataAdapter = New OleDbDataAdapter ( “SELECT FROM ATG WHERE Term Like ‘*” & (TextBox1.Text) & “*'”, _ ConnectString)
dbDataAdapter.Fill(dtATG)
DataGrid1.DataSource = dtATG
End Sub
End Class
July 3, 2011 at 4:53 pm
The correct statement should probably be
“SELECT * FROM ATG WHERE Term Like ‘%” & (TextBox1.Text) & “%’”
If that doesn’t work, replace % with asterisk (*) and retry.
July 4, 2011 at 2:58 am
Hey Pradeep, I tried both the options.
However I get an error pointing to
dbDataAdapter.Fill(dtATG)
Error:
OleDbException was unhandeled
“The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.”
Any solutions to crack this?
Thanks for your help!
July 4, 2011 at 7:22 am
Hey Pradeep,
I tried this and it works. Thanks!
SELECT * FROM ATG WHERE Term LIKE ‘%” & ContainsTextBox1.Text & “%’.
Right now I have 5 textboxes and when I leave either one of them empty I dont get any results in the grid. Any soultions to this? Has it got to do something with ‘null’
July 4, 2011 at 8:03 am
The answer is easy but it looks like it would be a long discussion and spoils the purpose of a guestbook.
Forums are more appropriate for such Q/A & discussions.
Can you please create a thread here and PM me a link to the thread? VB Forums (VB.NET section)
Me or anyone else there would be glad to help you out with your problems. My user handle on that forum is pradeep1210
September 10, 2011 at 3:27 pm
Hey Pradeep, where can I send you an email?
Keep up the good work!
Dan
December 3, 2011 at 4:29 pm
p r a d e e p 1 2 1 0 @ h o t m a i l . c o m (without spaces)
December 1, 2011 at 3:34 pm
Hey pradeep,
I was hoping you could help me, I need to run a console app when clicking a button in a form and need it to write the output into a .xml file, not sure of the best way to do this.
Also i need to replace a line of text in the file created that is always the same as the output while is formatted for xml does not have the xml opener at the top.
This is the code i have so far which will run the app with the arguements need.
Any chance you could help me?
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim process1 As New Process()
process1.StartInfo.UseShellExecute = False
process1.StartInfo.FileName = “app.exe”
process1.StartInfo.Arguments = “-x a default.ext”
process1.StartInfo.CreateNoWindow = False
process1.StartInfo.RedirectStandardOutput = True
process1.Start()
process1.StandardOutput.ReadToEnd()
process1.WaitForExit()
process1.Close()
End Sub
December 3, 2011 at 4:42 pm
You would need to ensure that your console application (app.exe) exits itself after doing the intended work.
June 22, 2015 at 1:13 pm
Hi Pradeep,
I have been using your query Executing a set of SQL Script Files (*.sql) on a Group of SQL Server Databases in my production environment since a month recently i found out that if we omit
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
in a stored procedure the and execute your script SET QUOTED IDENTIFIER is turning OFF
can u plz let me know where i have to modify to make the old settings as it is?
Many Thanks for your query it is saving lot of my time
June 26, 2015 at 7:20 am
I haven’t tested but my best bet would be modifying line #34 as follows:
UPDATE @FileList SET Command = 'SET ANSI_NULLS ON; SET QUOTED_IDENTIFIER ON; sqlcmd -S ' + @ServerName
...
Let me know if this works (or doesn’t work).
June 26, 2015 at 1:24 pm
Thanks for your response Pradeep, it’s not working
UPDATE @FileList SET Command = ‘SET ANSI_NULLS ON; SET QUOTED_IDENTIFIER ON,sqlcmd -S ‘ + @ServerName
+ ‘ -d %DATABASE% -i “‘ + @ScriptFilesDir + FileName
+ ‘” >> ‘ + @ScriptFilesDir + ‘Output.txt’
(update statement looks like above)
there are several Procedures kept in a folder without mentioning SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
in old procedure QUOTED_IDENTIFIER is ON in updated procedure the QUOTED_IDENTIFIER is OFF