Click here to Skip to main content
15,887,434 members
Home / Discussions / Database
   

Database

 
GeneralRe: how to add int Value Pin
getaccessyr28-Oct-09 22:10
getaccessyr28-Oct-09 22:10 
GeneralRe: how to add int Value Pin
Mycroft Holmes29-Oct-09 0:11
professionalMycroft Holmes29-Oct-09 0:11 
QuestionMSSQL SERVER Pin
MsmVc28-Oct-09 1:23
MsmVc28-Oct-09 1:23 
AnswerRe: MSSQL SERVER Pin
dan!sh 28-Oct-09 2:24
professional dan!sh 28-Oct-09 2:24 
GeneralRe: MSSQL SERVER Pin
MsmVc28-Oct-09 2:27
MsmVc28-Oct-09 2:27 
GeneralRe: MSSQL SERVER Pin
MsmVc28-Oct-09 18:32
MsmVc28-Oct-09 18:32 
GeneralRe: MSSQL SERVER Pin
Rob Graham29-Oct-09 8:08
Rob Graham29-Oct-09 8:08 
QuestionExecute Nonquery : Connection properly has not been initialized Pin
Mangesh Tomar27-Oct-09 22:56
Mangesh Tomar27-Oct-09 22:56 
i am inserting two record in data base usin txtReg and txtname using acess database when i run my program it shows following error
Execute Nonquery : Connection properly has not been initialized
here is my code

need help



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb ;

namespace studentManagementSystem1
{
public partial class StudentDetails : Form
{
public OleDbCommand cmd;
public OleDbConnection con;

string connectionString, query;
public StudentDetails()
{
InitializeComponent();
}




private void StudentDetails_Load(object sender, EventArgs e)
{

// TODO: This line of code loads data into the 'studmanageDataSet.master' table. You can move, or remove it, as needed.
this.masterTableAdapter.Fill(this.studmanageDataSet.master);


connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\studentManagementSystem1\studmanage.mdb";

}

private void btnAdd_Click(object sender, EventArgs e)
{


int rows;


query = "INSERT INTO master(RegNo,Name)VALUES(@RegNo,@Name)";

cmd = new OleDbCommand(query, con);
con = new OleDbConnection(this.connectionString);

cmd.Parameters.AddWithValue("@RegNo", txtRegNo.Text );
cmd.Parameters.AddWithValue("@Name", txtName.Text );



try
{
con = new OleDbConnection(this.connectionString);

con.Open();
rows = cmd.ExecuteNonQuery();
if (rows > 0)
{
MessageBox.Show("records inserted successfully");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
}

private void btnEdit_Click(object sender, EventArgs e)
{

}




}
}
AnswerRe: Execute Nonquery : Connection properly has not been initialized Pin
Covean27-Oct-09 23:24
Covean27-Oct-09 23:24 
AnswerRe: Execute Nonquery : Connection properly has not been initialized Pin
i.j.russell27-Oct-09 23:25
i.j.russell27-Oct-09 23:25 
AnswerRepost Pin
Not Active28-Oct-09 1:12
mentorNot Active28-Oct-09 1:12 
QuestionSSIS Permission Problem Pin
Vimalsoft(Pty) Ltd27-Oct-09 22:05
professionalVimalsoft(Pty) Ltd27-Oct-09 22:05 
AnswerRe: SSIS Permission Problem Pin
Rob Graham29-Oct-09 8:39
Rob Graham29-Oct-09 8:39 
GeneralRe: SSIS Permission Problem Pin
Vimalsoft(Pty) Ltd29-Oct-09 20:17
professionalVimalsoft(Pty) Ltd29-Oct-09 20:17 
QuestionEnumAvailableSqlServers does not list SQL 2000 server. Pin
hoangthu197427-Oct-09 21:15
hoangthu197427-Oct-09 21:15 
AnswerRe: EnumAvailableSqlServers does not list SQL 2000 server. Pin
Abhishek Sur27-Oct-09 22:46
professionalAbhishek Sur27-Oct-09 22:46 
GeneralRe: EnumAvailableSqlServers does not list SQL 2000 server. Pin
hoangthu197427-Oct-09 22:49
hoangthu197427-Oct-09 22:49 
GeneralRe: EnumAvailableSqlServers does not list SQL 2000 server. Pin
Abhishek Sur27-Oct-09 22:53
professionalAbhishek Sur27-Oct-09 22:53 
GeneralRe: EnumAvailableSqlServers does not list SQL 2000 server. Pin
hoangthu197427-Oct-09 23:01
hoangthu197427-Oct-09 23:01 
Questionhow to desinged tables? Pin
iceman861627-Oct-09 15:55
iceman861627-Oct-09 15:55 
AnswerRe: how to desinged tables? Pin
Mycroft Holmes27-Oct-09 20:57
professionalMycroft Holmes27-Oct-09 20:57 
GeneralRe: how to desinged tables? Pin
iceman861627-Oct-09 22:43
iceman861627-Oct-09 22:43 
GeneralRe: how to desinged tables? Pin
Mycroft Holmes28-Oct-09 14:32
professionalMycroft Holmes28-Oct-09 14:32 
GeneralRe: how to desinged tables? Pin
iceman861628-Oct-09 15:17
iceman861628-Oct-09 15:17 
GeneralRe: how to desinged tables? Pin
Mycroft Holmes28-Oct-09 15:23
professionalMycroft Holmes28-Oct-09 15:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.