I have made an application in which there r several textboxes and command buttons.
and when we press save button, the textboxes data get saved in access database.
when i enter normal text in the textbox, it is working.
but when i enter the below data in the textbox, the following error is displayed.
Data:
FILENAME INP "/dso/dsocln/ehco/medical/raw-input/ehco_bcne_cabc_F20120101_T20120331_vall.txt_94283";
Data all;
INFILE INP
END = EOF
RECFM = v
LRECL = 760
TRUNCOVER
;
input
@170 DateofBirth $CHAR10. /* Date of Birth */
;
output all;
run;
proc freq data = all;
tables DateofBirth / list missing;
title'DateofBirth';
run;
Error:
Syntax error (missing operator) in query expression ''FILENAME INP "/dso/dsocln/ehco/medical/raw-input/ehco_bcne_cabc_F20120101_T20120331_vall.txt_94283";
Can you please help me solving this error?
thanks in advance...
Problem With Saving textboxes data
Page 1 of 112 Replies - 658 Views - Last Post: 19 July 2012 - 07:03 AM
Replies To: Problem With Saving textboxes data
#2
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 09:24 PM
Means i am saying when i manually enter the data in one of the textboxes. Ans presses the save button, Then the data gets saved.
But if i copy the data from some outer source and paste the data in the Textbox. And now when i try to save the data, the above error generates.
The data which i pasted into the textbox is also mentioned in my prevoius thread.
Please help.
But if i copy the data from some outer source and paste the data in the Textbox. And now when i try to save the data, the above error generates.
The data which i pasted into the textbox is also mentioned in my prevoius thread.
Please help.
#3
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 09:45 PM
Properly Defined:
When i enter this data in the textbox:
title'DateofBirth';
and try to save the data
the error generates:
Syntax error (missing operator) in query expression ''title'DateofBirth';''.
When i enter this data in the textbox:
title'DateofBirth';
and try to save the data
the error generates:
Syntax error (missing operator) in query expression ''title'DateofBirth';''.
This post has been edited by abhishek415: 18 July 2012 - 09:47 PM
#4
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 10:12 PM
My code for saving textbox data is:
Dim dbPath As String = "C:\Users\Abhishek\Documents\ToolDatabase.mdb"
Dim connStr As String ="Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & dbPath & ";Jet OLEDB:Database Password=agupt80;"
Using connection As New OleDb.OleDbConnection(connStr)
Dim cmd As New OleDb.OleDbCommand
Dim trans As OleDb.OleDbTransaction
If (connection.State = ConnectionState.Closed) Then
connection.Open() 'Open connection to database
End If
cmd.Connection = connection
trans = connection.BeginTransaction(IsolationLevel.ReadCommitted)
cmd.Transaction = trans
Dim b As String = Me.TextBox2.Text
If (b = "") Then
b = "None"
End If
cmd.CommandText = "insert into Table1 values('" & b & "')"
cmd.ExecuteNonQuery() 'Execute command
trans.Commit()
End Using
This post has been edited by abhishek415: 18 July 2012 - 10:12 PM
#5
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 11:04 PM
Try with parameters. Always use parameters.
#6
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 11:08 PM
I also did that. But thats too not working...
My code is:
My code is:
Dim dbPath As String = "C:\Users\Abhishek\Documents\ToolDatabase.mdb"
Dim connStr As String ="Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & dbPath & ";Jet OLEDB:Database Password=agupt80;"
Using connection As New OleDb.OleDbConnection(connStr)
Dim cmd As New OleDb.OleDbCommand
Dim trans As OleDb.OleDbTransaction
If (connection.State = ConnectionState.Closed) Then
connection.Open() 'Open connection to database
End If
cmd.Connection = connection
trans = connection.BeginTransaction(IsolationLevel.ReadCommitted)
cmd.Transaction = trans
Dim b As String = Me.TextBox2.Text
If (b = "") Then
b = "None"
End If
cmd.CommandText = "insert into Table1 values('" & b & "')"
With cmd
.Parameters.AddWithValue("Description", Me.TextBox2.Text)
.ExecuteNonQuery() 'Execute command
End With
trans.Commit()
End Using
#7
Re: Problem With Saving textboxes data
Posted 18 July 2012 - 11:11 PM
If you use parameters then you must include them in the query.
cmd.CommandText = "INSERT INTO Table1 VALUES(@Description)"
#8
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 12:03 AM
cmd.CommandText = "insert into Table1(@Description) values ("'Me.Textbox2.text'")"
With cmd
.Parameters.AddWithValue("@Description", Me.TextBox2.Text)
.ExecuteNonQuery() 'Execute command
End With
Now it is saying Sysntax error in Insert Command.
This post has been edited by abhishek415: 19 July 2012 - 12:03 AM
#9
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 12:11 AM
this is your code:
and this is what I said how it should looks:
or
cmd.CommandText = "insert into Table1(@Description) values ("'Me.Textbox2.text'")"
and this is what I said how it should looks:
cmd.CommandText = "INSERT INTO Table1 VALUES(@Description)"
or
cmd.CommandText = "INSERT INTO Table1 ("Here goes the field name where you want to put value") VALUES(@Description)"
#10
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 12:14 AM
My field name in access 2003 is Description where i want to put the value of TextBox2.
Now can u tell me the Syntax?
Now can u tell me the Syntax?
#11
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 12:22 AM
cmd.CommandText = "INSERT INTO Table1 (Description) VALUES(@Description)"
#12
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 12:31 AM
Thank You Sela007
It really Worked.
Hats Off...!!
God Bless You...!!
It really Worked.
Hats Off...!!
God Bless You...!!
#13
Re: Problem With Saving textboxes data
Posted 19 July 2012 - 07:03 AM
Who the frak do you think you are?! Do not ever PM someone and attempt to hand out assignments like this again!
The people here are volunteers, not your employees. You do not write them and tell them to "solve the problem" and "sort it out" like you are their boss.
You also need to consider that you are on an American website from a foreign country: We aren't in your same time zone. You wrote this in the middle of the night USA time. Nobody wants to wake up to this.
I don't give a frak what kind of jam you got yourself into, you have to be patient and let the experts in each area have time to look at the questions posted over night and decide for themselves which ones they choose to answer and which ones they are qualified to answer. You had NO REASON to start spamming experts, begging for help with a question you had just posted. Obviously the volunteer system works because sela007 was able to help you out - before I even woke up I might add.
Just remember you are one of 500,000 members of this board. The last thing we need is to have everyone thinking as you do, that they are somehow special and more important than everyone else so they can send out messages telling others to help them. I do not need to wake up to 10,000 pleas for help every morning.
The people here are volunteers, not your employees. You do not write them and tell them to "solve the problem" and "sort it out" like you are their boss.
You also need to consider that you are on an American website from a foreign country: We aren't in your same time zone. You wrote this in the middle of the night USA time. Nobody wants to wake up to this.
I don't give a frak what kind of jam you got yourself into, you have to be patient and let the experts in each area have time to look at the questions posted over night and decide for themselves which ones they choose to answer and which ones they are qualified to answer. You had NO REASON to start spamming experts, begging for help with a question you had just posted. Obviously the volunteer system works because sela007 was able to help you out - before I even woke up I might add.
Just remember you are one of 500,000 members of this board. The last thing we need is to have everyone thinking as you do, that they are somehow special and more important than everyone else so they can send out messages telling others to help them. I do not need to wake up to 10,000 pleas for help every morning.

Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|