虽然我在SQL服务器中创建了大量的proc,但我想开始使用MariaDB,因此尝试在MySQL Workbench中创建下面的简单proc。
我一直收到一条错误消息,说明开场时缺少SELECT('在表名后面:
DELIMITER $$
drop procedure if exists usp_AddSentEmail$$
CREATE PROCEDURE usp_AddSentEmail (in pSender varchar(36)
,in pTo varchar(1000)
,in pSubject varchar(100)
,in pBody varchar(10000)
,in pRecordDT datetime)
BEGIN
INSERT INTO Emails('To','Subject','Body','Sender','RecordDT','Sent','SentDT')
VALUES (pTo,pSubject,pBody,pSender,pRecordDT,1,pRecordDT);
END$$
DELIMITER ;
也许我正在尝试错误的谷歌搜索,但所有出现的都是分隔符错误。
答案 0 :(得分:1)
从插入查询中的列名中删除引号:
EditText editmsg , editmail ;
TextView content ;
String Message , Email ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editmsg = (EditText) findViewById(R.id.editMessage);
editmail = (EditText) findViewById(R.id.editMail);
Button btnsubmit = (Button) findViewById(R.id.btnSubmit);
btnsubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
GetText();
} catch (Exception ex) {
content.setText(" Url Exception!");
}
}
});
}
public void GetText()throws UnsupportedEncodingException {
Message = editmsg.getText().toString();
Email = editmail.getText().toString();
String data = URLEncoder.encode("message", "UTF-8")
+ "=" + URLEncoder.encode(Message, "UTF-8");
data += "&" + URLEncoder.encode("email", "UTF-8") + "="
+ URLEncoder.encode(Email, "UTF-8");
String text = "";
BufferedReader reader=null;
HttpURLConnection urlConnection = null;
try
{
// Defined URL where to send data
URL url = new URL("http://nitesh.com/feedback/add.php");
// Send POST data request
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(urlConnection.getOutputStream());
wr.write( data );
wr.flush();
// Get the server response
reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
// Read Server Response
while((line = reader.readLine()) != null)
{
// Append server response in string
sb.append(line + "\n");
}
text = sb.toString();
}
catch(Exception ex)
{
}
finally
{
try
{
reader.close();
}
catch(Exception ex) {}
}
// Show response on activity
content.setText( text );
}