Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. how to insert wifi scan data into sql table

how to insert wifi scan data into sql table

Scheduled Pinned Locked Moved Visual Studio
csharpsharepointdatabaselinqgraphics
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Olu_01
    wrote on last edited by
    #1

    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(
    
    W 1 Reply Last reply
    0
    • O Olu_01

      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(
      
      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Please do not repost. You already asked the question here[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups