Click here to Skip to main content
15,897,187 members
Home / Discussions / Database
   

Database

 
AnswerRe: database Pin
WoutL28-Oct-09 22:48
WoutL28-Oct-09 22:48 
AnswerRe: database Pin
dan!sh 29-Oct-09 0:23
professional dan!sh 29-Oct-09 0:23 
AnswerRe: database Pin
Mycroft Holmes29-Oct-09 0:25
professionalMycroft Holmes29-Oct-09 0:25 
AnswerRe: database Pin
dxlee29-Oct-09 4:16
dxlee29-Oct-09 4:16 
AnswerRe: database Pin
dreamaway82029-Oct-09 5:46
dreamaway82029-Oct-09 5:46 
AnswerRe: database Pin
Eddy Vluggen29-Oct-09 9:29
professionalEddy Vluggen29-Oct-09 9:29 
QuestionThe Saga Continues Pin
Roger Wright28-Oct-09 21:45
professionalRoger Wright28-Oct-09 21:45 
QuestionHow to seperate records Pin
kKamel28-Oct-09 20:35
kKamel28-Oct-09 20:35 
AnswerRe: How to seperate records Pin
Mycroft Holmes29-Oct-09 0:14
professionalMycroft Holmes29-Oct-09 0:14 
GeneralRe: How to seperate records Pin
kKamel29-Oct-09 0:44
kKamel29-Oct-09 0:44 
GeneralRe: How to seperate records Pin
Mycroft Holmes29-Oct-09 2:01
professionalMycroft Holmes29-Oct-09 2:01 
QuestionRe: How to seperate records Pin
Eddy Vluggen29-Oct-09 12:03
professionalEddy Vluggen29-Oct-09 12:03 
Questionhow to add int Value Pin
getaccessyr28-Oct-09 4:04
getaccessyr28-Oct-09 4:04 
GeneralRe: how to add int Value Pin
Mycroft Holmes28-Oct-09 14:42
professionalMycroft Holmes28-Oct-09 14:42 
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 

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.