#include<fstream.h>
#include<iostream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#include<process.h>
using namespace std;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

using WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
string connectionString ="server=sroque\\sqlexpress;database=InventoryDB;uid=sa;pwd=ripple";

SqlConnection mySqlConnection = new SqlConnection(connectionString);

string selectString = "SELECT * FROM tblUsers";

SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = selectString;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();

mySqlDataAdapter.SelectCommand = mySqlCommand;

DataSet myDataSet = new DataSet();

mySqlConnection.Open();

string dataTableName = "tblUsers";
mySqlDataAdapter.Fill(myDataSet, dataTableName);

DataTable myDataTable = myDataSet.Tables[dataTableName];

foreach (DataRow myDataRow in myDataTable.Rows)
{
txtId.Text = "" + myDataRow["userID"];
txtUser.Text = "" + myDataRow["Name"];
txtPosition.Text = "" + myDataRow["Position"];
}
mySqlConnection.Close();
}

private void btnAdd_Click(object sender, EventArgs e)
{
if (btnAdd.Text == "&Add")
{
txtId.Text = "";
txtUser.Text = "";
txtPosition.Text = "";
btnAdd.Text = "&Save";
}
else if (btnAdd.Text == "&Save")
{
//then here I want to save records from the textbox to my database




	 const int MAX = 100;
	 const int MAXINV = 100;
	const int ROWS = 4;

	int view(char *string2, int * inv);
	 int edit(char *string2, int * inv);

	  int main()

      {
      fstream hardware;
      int *inv = 0;
      int c = 0;
      char input;
      char string1[MAX];
      char *string2[100][4];
      char *delim = ";";
      char *token;
      hardware.open("hardware.dat", ios::in | ios::out);
      if (hardware.fail())
      {
      cout << "File Open Failed.\n";
      exit(1);
      }

      cout << "Menu\n" << endl
      << "Action: Enter: " << endl
      << "View Inventory V" << endl
      << "Edit Entry E" << endl
      << "Quit Q" << endl;
   cin >> input;
      switch(input)
      {
      case 'V':
    case 'v':view(string2[100][4],(int*) *inv);
   break;
    case 'E':
    case 'e':edit(string2[100][4],(int*) inv);
   break;
   default:
   exit(1);
    }
      while (! hardware.eof())
   {
   cin.getline(string1, MAX);
   token = strtok(string1, delim);
   while (token != NULL)
  {
      cout << "token " << c << " is " << endl << token << endl;
      if (c >= ROWS)
   {

    c=0;
 inv++;
   }

string2[*inv][c] = token;

      token = strtok(NULL,delim);
      c++;
   }
   }
      hardware.close();
      return 0;
     }
      int view(char *string2[100][4], int * inv)
   {
    int i,j;
   for (i=0; i <= *inv; i++)
  {
    for (j=0; j <= 4; j++)
   {
   cout << string2[i][j] << endl;
   }
   }
   return 0;
   }

    int edit(char *string2[100][4], int * inv,fstream hardware)
   {

    int num;
    int i,j;
      char string1[MAX];
 cout << "Enter Inv. Number: ";
   cin >> num;
     for (j=0; j <= 4; j++)
   {
    cout << string2[num][j] << ";" << endl;
    }

 cin.getline(string1, MAX);

     hardware.
     seekg(0,ios::beg);
      for (i=0; i <= *inv; i++)
    {
  for (j=0; j <= 4; j++)
   {
   cout << string2[i][j] << ";" << endl;
      }
    }      return 0;
      }

}
}
}
}

Could you please post using code tags?
It looks better to me if you'd migrate your code to be more standard, this guide will help you to accomplish the task :)

And also: what problem are you having with this code?
(you only posted your code, but you didn't ask a question, please keep in mind that we're not clairvoyant)

This article has been dead for over six months. Start a new discussion instead.