all groups > visual studio .net general > august 2006 >
You're in the

visual studio .net general

group:

Command contains unrecognized phrase/keyword VB.Net



Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/13/2006 6:31:01 AM
visual studio .net general: Hi

I am facing the above problem when I am trying to insert a MEMO data in
to the VFP table. I am using a OLEDB connection string in VB.Net

My data present in the file is

//------------------------------

Pen

Pencil

Erasier

Sharpener

//----------------------------

Each an every line has a (Vbcrlf) that is a line feed in it I need the File
as in the above format to be stored in the memo file without any change

I get the data from the file by the following procedure

----------

Dim lstrData As New String(" ", 500)

FileOpen(1, "C:\soc.txt", OpenMode.Binary)

FileGet(1, lstrData)

FileClose(1)

--------

I get the data in the lstrdata Now I use sql statment to insert into the vfp
table

sql = "Insert into edifile (theirref,qtnord ) Values (' " & lstrdata & "',
'RRTo')

Public gconnMDB_I As OleDb.OleDbConnection

gconnMDB_I = New OleDb.OleDbConnection

gconnMDB_I.ConnectionString = lstrConnString

Call gconnMDB_I.Open()

Dim cmd As New OleDb.OleDbCommand

cmd = New OleDb.OleDbCommand(sql, gconnMDB_I)

cmd.ExecuteNonQuery()

Once cmd.ExecuteNonQuery is excuted the following error occurs

Command contains unrecognized phrase/keyword VB.Net

RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/14/2006 2:17:02 AM
Hi,

You're getting the exception because you're concatenating strings to build
the SQL statement. The value for those fields might be invalid for SQL
statement. Thus, it'll be better to use paremeters.

sql = "Insert into edifile (theirref,qtnord ) Values (?, 'RRTo')

Public gconnMDB_I As OleDb.OleDbConnection

gconnMDB_I = New OleDb.OleDbConnection

gconnMDB_I.ConnectionString = lstrConnString

Call gconnMDB_I.Open()

Dim cmd As New OleDb.OleDbCommand

cmd = New OleDb.OleDbCommand(sql, gconnMDB_I)

cmd.Parameters.Add("lstrdata", System.Data.OleDb.OleDbType.Char, 100)
'Use parameter here.

cmd.Parameters("lstrdata").Value = lstrdata 'Assign value to it.

cmd.ExecuteNonQuery()

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/16/2006 12:00:00 AM
Hi,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/16/2006 4:39:01 AM

Kevin the reply you have posted was very useful. thank you. I have another
two quires
1. How I have to retrieve the same from database (ie) I have a a
memo filed I have to retrieve the data from the memo field from the database.

2. I have created an window application which has
Application.doevents
Now I am converting the application to Window services.. I find
that Application.doevents is not a valid window service command. I need a
similar command as that of application.doevents. Since once process has to
get over until the other process sholud not start




RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/16/2006 11:16:02 PM
Hi,
Got an idea on the above, Can we select a memo field using a select
command in VFP is it possible.

I have another question also. I have a service which runs as a backgroud
process now. But the issues is that I need to load the same process in the
screen If the user logs in. the process should be in the taskbar once He logs
in. If the User clicks the icon the process sholud get loaded in the screen.
Example : SQL-Agent
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/17/2006 1:51:01 AM
added to the above I have another question U said about the
Application.doevents. I am using winsock control to send and recieve data
from the mailserver. As you know once the command is sent thru the Send
command to the mailserver thru the winsock control, the Dataarrival gets
fired only after a small time gap for that I used Application.doevents to get
that process complete such hat I ll move to the next (Send/ recieve) command,
but I am very much Confused on how to use this in Multithreading. Since the
dataarival will be fired only by the Winsock control I not able to monitor
the winsock datarrival

I need to have the control in my hand in such a way that I can monitor the
send / recieve data from the dataarival in winsock

Tell me how can I use Multithreading on the above are tell me a suitable
Idea to make this run



[quoted text, click to view]
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/17/2006 1:52:01 AM
added to the above I have another question U said about the
Application.doevents. I am using winsock control to send and recieve data
from the mailserver. As you know once the command is sent thru the Send
command to the mailserver thru the winsock control, the Dataarrival gets
fired only after a small time gap for that I used Application.doevents to get
that process complete such hat I ll move to the next (Send/ recieve) command,
but I am very much Confused on how to use this in Multithreading. Since the
dataarival will be fired only by the Winsock control I not able to monitor
the winsock datarrival

I need to have the control in my hand in such a way that I can monitor the
send / recieve data from the dataarival in winsock

Tell me how can I use Multithreading on the above are tell me a suitable
Idea to make this run



[quoted text, click to view]
RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/17/2006 4:04:29 AM
Hi,

1. You can use a DataAdapter to fill the memo field to a DataSet. A memo
field is mapped to System.String in .NET framework. For more information
about how to use a DataAdapter to fill data, please check the following
link:

http://msdn2.microsoft.com/en-us/library/ms254931.aspx

2. There is no equivalence for Application.DoEvents in windows service. In
my opinion, you don't need to repaint UI when your service is handling
events. If you need to asynchronously process multiple tasks in the
service, you have to use multi-thread your self.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/18/2006 3:25:17 AM
Hi,

Yes, we can select a memo field using a select command in VFP.

Here I have to clarify something. A windows service is a background process
which starts before any user logs on. Also, a windows service does not
interact with the desktop. Generally, if we need to talk with the service,
we use another desktop app to call that service.

If you need to write an app that starts with user log on, it has to be a
windows form app, which starts with the window hidden and add an icon in
the system tray. Here is a sample for your reference.

http://www.codeguru.com/Csharp/.NET/net_general/tipstricks/article.php/c6933
/

In your post, you mentioned that the data arrival event is fired after a
small time gap. Is it because the execution thread is busying with other
tasks in your original app? Also, for reasons stated above, I don't suggest
your convert this project into a windows service.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/19/2006 12:35:01 AM
Hi
I ll check it out let you know on selecting a Memo filed in VFP.

Regading the window services is a background I can understand but tell me
How is Mdemon works how is SQL server agent works. They have a service at the
background and they bring it at the time of log in the systemtray. You can
see an interactive screen for Mdemon(mailserver). you colud find the incoming
mail and outgoing mail and many things you colud see in that screen. When I
log of the system the mailserver runs on its own as a service.

The sample you have given me as a link will give me an output to put the
application in the systemtray.

Can you understand my requirement. I know How to creat a service. I know how
to creat an icon In the systemtray. The issue is that I should not run two
process for one application in my memory. There will not be two process
runnig if you are running the SQLserveragent or Mdemon applicaion. I need
something that of the same. Please help me on this line.

See I don't need to call a service since a service is started Automatically.
I cannot stop a service when Its running. and make my desktop application to
be worked. Let me be clear on that. tell me a solution on this line.

Regarding the Multithreding
You are right my execution process is given the first preference than
the other process. My question is that I want to make my process wait until
the process in que gets completed and my process will get continued this is
help me in Application.doevents now My question is I need similar process In
Multithreading or in any other form other than the above since I have to use
it in services. I ll put is very clear My requirement is that I sholud run
the winsock as service. I have created as an application. Now I need to
convert it as a service.

My code created in winsock as An application in vb.Net

Imports MSWinsockLib

Dim WithEvents lwinSock As New Winsock

Private Sub mprPOPSMTP()

lwinSock.Protocol = ProtocolConstants.sckTCPProtocol
lwinSock.RemotePort = 110
lwinSock.RemoteHost = mailserver
lwinSock.Connect()
'Since I said Connect
'lwinSock_Connect() gets fired first
'lwinSock_DataArrival gets fired second
End Sub

Private Sub lwinSock_Connect() Handles lwinSock.Connect
'Once the Connection is sucessful this event gets fired
'I call a function from this event to continue my process
mprWorkinProcess()

End Sub

Private Sub lwinSock_DataArrival(ByVal bytesTotal As Integer) Handles
lwinSock.DataArrival
Dim lbytdata As Byte()
lwinSock.GetData(lbytdata)
'gstrdata is a global variable
gstrData = System.Text.Encoding.ASCII.GetString(lbytdata)
'gstrCheckData is a global variable
gstrCheckData = Mid(gstrData, 1, 3)

end sub

Private Sub mprWorkinProcess()

While (True)
Sleep(100)
Application.DoEvents()
'If I find that gstrcheckdata is having a reply then I ll
give next command
If gstrCheckData = "OK+" Then
gstrCheckData = ""
lwinSock.SendData(gstrUser + vbCrLf)
While (True)
Sleep(100)
Application.DoEvents()
'If I find that gstrcheckdata is having a reply then I ll
give next command
If gstrCheckData = "OK+" Then
gstrCheckData = ""
lwinSock.SendData(gstrPass + vbCrLf)
While (True)
Sleep(100)
Application.DoEvents()
'If I find that gstrcheckdata is having a reply then I ll
give next command
If gstrCheckData = "OK+" Then
gstrCheckData = ""
Exit While
End If
End While
Exit While
End If
End While
Exit While
End If
End While

end sub


This is how I have used my Application.Doevents is used Don't Debug the code
I have given an Idea from my code and Not the original one but this leads to
my original code
If I have not used Application.Doevents the Dataarrival will not be fired I
ll end up in indefinite loop where GstrCheckData will never be "OK+" where I
have trimed In the Dataarrival.

Now let me know how on to find a path to reach the goal in the window
services on not using Application.Doevents.

RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/21/2006 12:00:00 AM
Hi,

I haven't used Mdemon before but I think there might be some
misunderstanding here in SQL Agent. SQL Angent is a windows service, which
starts before a user is logged on to system. It makes your server do a lot
of things (For example, backup your database) without a user's logon. While
the Service Manager you see in the System Tray is another app. It monitors
the status of SQL server database service, SQL Agent service and other SQL
services. And you can start/stop/pause the services through this tool. So
the icon in the system tray is NOT a part of SQL Agent service. They are
running in two processes. This might be not the same as you though, but it
is true. The process name for Service Manager is sqlmangr.exe. While SQL
Agent is running in process: sqlagent.exe.

So in this case, please let me know what your application is doing. With
the current vague image to your app, I don't think this application suits
for a windows service.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net v-kevy NO[at]SPAM online.microsoft.com
8/23/2006 12:00:00 AM
Hi,

If you have any concern on this issue, please let me know.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/23/2006 5:24:02 AM
Thanks
I have done with the Issue
RE: Command contains unrecognized phrase/keyword VB.Net Komandur Kannan
8/23/2006 5:26:02 AM

Thanks
I have done with the issue
AddThis Social Bookmark Button