how to insert wifi scan data into sql table
-
Urgent assist required. Can someone help pls, i have scanned wifi data in C# that i have split into required form MAC,SSID and RSSi . i want when i push a button the results are inserted into an sql table that i already created. and if i push the buton again it stops inserting. I have tried several methods and could not get it to work, Will appreciate assist
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;namespace WICED_SERIALPORT_TEST
{
public partial class Form1 : Form{ public Form1() { InitializeComponent(); } private void button1\_Click(object sender, EventArgs e) { string\[\] ports = SerialPort.GetPortNames(); foreach (string port in ports) { comboBox1.Items.Add(port); } } // string t; private void button2\_Click(object sender, EventArgs e) { t = comboBox1.Text.ToString(); sErial(t); } // SerialPort sp; void sErial(string Port\_name) { sp = new SerialPort(Port\_name, 115200, Parity.None, 8, StopBits.One); sp.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); sp.Open(); } // private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; string msg = string.Empty; bool canCont = false; while (!canCont) { msg += sp.ReadLine(); if (msg.Contains("Scan complete ")) { canCont = true; } } //string w = sp.ReadLine(); //string w = sp.ReadExisting(); // string msg = sp.ReadExisting(); string\[\] msgArr = msg.Split('\\r'); Invoke(new Action(() => listBox1.Items.Clear())); List<string\[\]> list = new List<string\[\]>(); List<Networks> Scan = new List<Networks>(); for (int i = 0; i < msgArr.Length; i++) { list.Add(msgArr\[i\].Split(
-
Urgent assist required. Can someone help pls, i have scanned wifi data in C# that i have split into required form MAC,SSID and RSSi . i want when i push a button the results are inserted into an sql table that i already created. and if i push the buton again it stops inserting. I have tried several methods and could not get it to work, Will appreciate assist
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;namespace WICED_SERIALPORT_TEST
{
public partial class Form1 : Form{ public Form1() { InitializeComponent(); } private void button1\_Click(object sender, EventArgs e) { string\[\] ports = SerialPort.GetPortNames(); foreach (string port in ports) { comboBox1.Items.Add(port); } } // string t; private void button2\_Click(object sender, EventArgs e) { t = comboBox1.Text.ToString(); sErial(t); } // SerialPort sp; void sErial(string Port\_name) { sp = new SerialPort(Port\_name, 115200, Parity.None, 8, StopBits.One); sp.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); sp.Open(); } // private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; string msg = string.Empty; bool canCont = false; while (!canCont) { msg += sp.ReadLine(); if (msg.Contains("Scan complete ")) { canCont = true; } } //string w = sp.ReadLine(); //string w = sp.ReadExisting(); // string msg = sp.ReadExisting(); string\[\] msgArr = msg.Split('\\r'); Invoke(new Action(() => listBox1.Items.Clear())); List<string\[\]> list = new List<string\[\]>(); List<Networks> Scan = new List<Networks>(); for (int i = 0; i < msgArr.Length; i++) { list.Add(msgArr\[i\].Split(