Can't insert data forms to sql server using electronHow to check if a column exists in a SQL Server table?How can I get column names from a table in SQL Server?Sql Server 'Saving changes is not permitted' error ► Prevent saving changes that require table re-creationHow to turn IDENTITY_INSERT on and off using SQL Server 2008?SQL Server - Return value after INSERTEfficiently convert rows to columns in sql serverRename column SQL Server 2008How to Delete using INNER JOIN with SQL Server?SQL Server Insert if not existReset identity seed after deleting records in SQL Server
Why didn’t Doctor Strange stay in the original winning timeline?
Infinite loop in CURSOR
Does C++20 mandate source code being stored in files?
Chess software to analyze games
Convert HTML color to OLE
Church Booleans
How do you call it when two celestial bodies come as close to each other as they will in their current orbits?
Did the twin engined Lazair ultralight have a throttle for each engine?
Is there any road between the CA State Route 120 and Sherman Pass Road (Forest Route 22S0) that crosses Yosemite/Serria/Sequoia National Park/Forest?
How can I describe being temporarily stupid?
How to dismiss intrusive questions from a colleague with whom I don't work?
How do I intentionally fragment a SQL Server Index?
Writing/buying Seforim rather than Sefer Torah
What is the evidence on the danger of feeding whole blueberries and grapes to infants and toddlers?
How to think about joining a company whose business I do not understand?
Can my boss not paying for hours I put in to clean bar after we close?
Are there categories whose internal hom is somewhat 'exotic'?
Earliest evidence of objects intended for future archaeologists?
Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")
How could China have extradited people for political reason under the extradition law it wanted to pass in Hong Kong?
Have ejective consonants ever arisen on their own?
Are required indicators necessary for radio buttons?
Sous vide chicken without an internal temperature of 165
Can I submit a paper under an alias so as to avoid trouble in my country?
Can't insert data forms to sql server using electron
How to check if a column exists in a SQL Server table?How can I get column names from a table in SQL Server?Sql Server 'Saving changes is not permitted' error ► Prevent saving changes that require table re-creationHow to turn IDENTITY_INSERT on and off using SQL Server 2008?SQL Server - Return value after INSERTEfficiently convert rows to columns in sql serverRename column SQL Server 2008How to Delete using INNER JOIN with SQL Server?SQL Server Insert if not existReset identity seed after deleting records in SQL Server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Whenever I click the submit button, it won't transfer the data to mssql.
It seems like it only works on hard-coded query with onload events without the web forms.
HTML
<form>
First Name:<input type="text" id="first_name" required="true"/>
Last Name: <input type="text" id="last_name" required="true"/>
<button onclick="formdata()"> Submit </button>
</form>
Javascript
function formdata()
var sql = require('mssql');
var config =
userName: 'username',
password: 'password',
server: 'server',
database: 'database',
options:
instanceName: 'instancename'
, encrypt: false
;
sql.connect(config, function (err)
if (err) console.log(err);
var request = new sql.Request();
var fn = document.getElementById('first_name').value;
var ln = document.getElementById('last_name').value;
request.query('execute sp_tmp_name fn,ln');
);
sql-server-2008 electron
add a comment |
Whenever I click the submit button, it won't transfer the data to mssql.
It seems like it only works on hard-coded query with onload events without the web forms.
HTML
<form>
First Name:<input type="text" id="first_name" required="true"/>
Last Name: <input type="text" id="last_name" required="true"/>
<button onclick="formdata()"> Submit </button>
</form>
Javascript
function formdata()
var sql = require('mssql');
var config =
userName: 'username',
password: 'password',
server: 'server',
database: 'database',
options:
instanceName: 'instancename'
, encrypt: false
;
sql.connect(config, function (err)
if (err) console.log(err);
var request = new sql.Request();
var fn = document.getElementById('first_name').value;
var ln = document.getElementById('last_name').value;
request.query('execute sp_tmp_name fn,ln');
);
sql-server-2008 electron
add a comment |
Whenever I click the submit button, it won't transfer the data to mssql.
It seems like it only works on hard-coded query with onload events without the web forms.
HTML
<form>
First Name:<input type="text" id="first_name" required="true"/>
Last Name: <input type="text" id="last_name" required="true"/>
<button onclick="formdata()"> Submit </button>
</form>
Javascript
function formdata()
var sql = require('mssql');
var config =
userName: 'username',
password: 'password',
server: 'server',
database: 'database',
options:
instanceName: 'instancename'
, encrypt: false
;
sql.connect(config, function (err)
if (err) console.log(err);
var request = new sql.Request();
var fn = document.getElementById('first_name').value;
var ln = document.getElementById('last_name').value;
request.query('execute sp_tmp_name fn,ln');
);
sql-server-2008 electron
Whenever I click the submit button, it won't transfer the data to mssql.
It seems like it only works on hard-coded query with onload events without the web forms.
HTML
<form>
First Name:<input type="text" id="first_name" required="true"/>
Last Name: <input type="text" id="last_name" required="true"/>
<button onclick="formdata()"> Submit </button>
</form>
Javascript
function formdata()
var sql = require('mssql');
var config =
userName: 'username',
password: 'password',
server: 'server',
database: 'database',
options:
instanceName: 'instancename'
, encrypt: false
;
sql.connect(config, function (err)
if (err) console.log(err);
var request = new sql.Request();
var fn = document.getElementById('first_name').value;
var ln = document.getElementById('last_name').value;
request.query('execute sp_tmp_name fn,ln');
);
sql-server-2008 electron
sql-server-2008 electron
edited Apr 8 at 5:35
JMC
asked Mar 27 at 14:49
JMCJMC
114 bronze badges
114 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Updated
I finally work it out. I included the ipcmain and ipcrenderer part to make it work.
Forms js
const ipcRenderer = require('electron').ipcRenderer;
function formdata(event)
event.preventDefault()
let fn = document.getElementById('first_name').value;
let ln = document.getElementById('last_name').value;
ipcRenderer.send('form-submission', fn,ln)
//pass ipcRenderer data to ipcmain
Main js
const app, BrowserWindow, ipcMain = require('electron')
........
ipcMain.on('form-submission', function (event, first_name,last_name)
event.preventDefault()
var sql = require('mssql');
const pool = new sql.ConnectionPool(
user: 'xxxx',
password: 'xxxx',
server: 'xxxx',
database: 'xxxx',
options:
instanceName: 'xxxx'
, encrypt: false
)
var conn = pool;
conn.connect().then(function ()
var request = new sql.Request(conn);
request.query("execute sp_tmp_name_sample" +" "+ first_name +","+last_name).then(function (recordset)
console.log(recordset);
conn.close();
)
.catch(function (err)
console.log(err);
conn.close();
);
);
)
HTML
<form action="#" method="post" name="ipcForm">
First Name:<input type="text" id="first_name" name="first_name" placeholder="First Name" required="true"/>
Last Name: <input type="text" id="last_name" name="last_name" placeholder="Last Name" required="true"/>
<input type="button" value="Submit" onclick="formdata(event)"/>
</form>
<script src="forms.js"></script>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380144%2fcant-insert-data-forms-to-sql-server-using-electron%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Updated
I finally work it out. I included the ipcmain and ipcrenderer part to make it work.
Forms js
const ipcRenderer = require('electron').ipcRenderer;
function formdata(event)
event.preventDefault()
let fn = document.getElementById('first_name').value;
let ln = document.getElementById('last_name').value;
ipcRenderer.send('form-submission', fn,ln)
//pass ipcRenderer data to ipcmain
Main js
const app, BrowserWindow, ipcMain = require('electron')
........
ipcMain.on('form-submission', function (event, first_name,last_name)
event.preventDefault()
var sql = require('mssql');
const pool = new sql.ConnectionPool(
user: 'xxxx',
password: 'xxxx',
server: 'xxxx',
database: 'xxxx',
options:
instanceName: 'xxxx'
, encrypt: false
)
var conn = pool;
conn.connect().then(function ()
var request = new sql.Request(conn);
request.query("execute sp_tmp_name_sample" +" "+ first_name +","+last_name).then(function (recordset)
console.log(recordset);
conn.close();
)
.catch(function (err)
console.log(err);
conn.close();
);
);
)
HTML
<form action="#" method="post" name="ipcForm">
First Name:<input type="text" id="first_name" name="first_name" placeholder="First Name" required="true"/>
Last Name: <input type="text" id="last_name" name="last_name" placeholder="Last Name" required="true"/>
<input type="button" value="Submit" onclick="formdata(event)"/>
</form>
<script src="forms.js"></script>
add a comment |
Updated
I finally work it out. I included the ipcmain and ipcrenderer part to make it work.
Forms js
const ipcRenderer = require('electron').ipcRenderer;
function formdata(event)
event.preventDefault()
let fn = document.getElementById('first_name').value;
let ln = document.getElementById('last_name').value;
ipcRenderer.send('form-submission', fn,ln)
//pass ipcRenderer data to ipcmain
Main js
const app, BrowserWindow, ipcMain = require('electron')
........
ipcMain.on('form-submission', function (event, first_name,last_name)
event.preventDefault()
var sql = require('mssql');
const pool = new sql.ConnectionPool(
user: 'xxxx',
password: 'xxxx',
server: 'xxxx',
database: 'xxxx',
options:
instanceName: 'xxxx'
, encrypt: false
)
var conn = pool;
conn.connect().then(function ()
var request = new sql.Request(conn);
request.query("execute sp_tmp_name_sample" +" "+ first_name +","+last_name).then(function (recordset)
console.log(recordset);
conn.close();
)
.catch(function (err)
console.log(err);
conn.close();
);
);
)
HTML
<form action="#" method="post" name="ipcForm">
First Name:<input type="text" id="first_name" name="first_name" placeholder="First Name" required="true"/>
Last Name: <input type="text" id="last_name" name="last_name" placeholder="Last Name" required="true"/>
<input type="button" value="Submit" onclick="formdata(event)"/>
</form>
<script src="forms.js"></script>
add a comment |
Updated
I finally work it out. I included the ipcmain and ipcrenderer part to make it work.
Forms js
const ipcRenderer = require('electron').ipcRenderer;
function formdata(event)
event.preventDefault()
let fn = document.getElementById('first_name').value;
let ln = document.getElementById('last_name').value;
ipcRenderer.send('form-submission', fn,ln)
//pass ipcRenderer data to ipcmain
Main js
const app, BrowserWindow, ipcMain = require('electron')
........
ipcMain.on('form-submission', function (event, first_name,last_name)
event.preventDefault()
var sql = require('mssql');
const pool = new sql.ConnectionPool(
user: 'xxxx',
password: 'xxxx',
server: 'xxxx',
database: 'xxxx',
options:
instanceName: 'xxxx'
, encrypt: false
)
var conn = pool;
conn.connect().then(function ()
var request = new sql.Request(conn);
request.query("execute sp_tmp_name_sample" +" "+ first_name +","+last_name).then(function (recordset)
console.log(recordset);
conn.close();
)
.catch(function (err)
console.log(err);
conn.close();
);
);
)
HTML
<form action="#" method="post" name="ipcForm">
First Name:<input type="text" id="first_name" name="first_name" placeholder="First Name" required="true"/>
Last Name: <input type="text" id="last_name" name="last_name" placeholder="Last Name" required="true"/>
<input type="button" value="Submit" onclick="formdata(event)"/>
</form>
<script src="forms.js"></script>
Updated
I finally work it out. I included the ipcmain and ipcrenderer part to make it work.
Forms js
const ipcRenderer = require('electron').ipcRenderer;
function formdata(event)
event.preventDefault()
let fn = document.getElementById('first_name').value;
let ln = document.getElementById('last_name').value;
ipcRenderer.send('form-submission', fn,ln)
//pass ipcRenderer data to ipcmain
Main js
const app, BrowserWindow, ipcMain = require('electron')
........
ipcMain.on('form-submission', function (event, first_name,last_name)
event.preventDefault()
var sql = require('mssql');
const pool = new sql.ConnectionPool(
user: 'xxxx',
password: 'xxxx',
server: 'xxxx',
database: 'xxxx',
options:
instanceName: 'xxxx'
, encrypt: false
)
var conn = pool;
conn.connect().then(function ()
var request = new sql.Request(conn);
request.query("execute sp_tmp_name_sample" +" "+ first_name +","+last_name).then(function (recordset)
console.log(recordset);
conn.close();
)
.catch(function (err)
console.log(err);
conn.close();
);
);
)
HTML
<form action="#" method="post" name="ipcForm">
First Name:<input type="text" id="first_name" name="first_name" placeholder="First Name" required="true"/>
Last Name: <input type="text" id="last_name" name="last_name" placeholder="Last Name" required="true"/>
<input type="button" value="Submit" onclick="formdata(event)"/>
</form>
<script src="forms.js"></script>
answered Apr 8 at 5:35
JMCJMC
114 bronze badges
114 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380144%2fcant-insert-data-forms-to-sql-server-using-electron%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown