Tuesday, 23 October 2012
c# for dummies: c sharp classes
c# for dummies: c sharp classes: Cannot insert null value Step 1: Open the sql server studio Step 2: open the table in particular i.e unionTB Step3: ...
c sharp classes
Cannot insert null value
Step 1:
Open the sql server studio
Step 2:
open the table in particular i.e unionTB
Step3:
Tick the column affected allow null
see the pictures.
Step 1:
Open the sql server studio
Step 2:
open the table in particular i.e unionTB
Step3:
Tick the column affected allow null
see the pictures.
c# for dummies: c sharp programming
c# for dummies: c sharp programming: Step1: If you are using class go to the class open it Step2: delete the database linq to sql classes and re add them. i.e ...
c sharp programming
If you are using class go to the class open it
Step2:
delete the database linq to sql classes and re add them. i.e munedb.dml
see pictures
Tuesday, 16 October 2012
c# for dummies: c sharp programming
c# for dummies: c sharp programming: // BY THE SPIRIT THE CREATOR OF THE WHOLE WORLD using System; using System.Collections.Generic; using System.ComponentModel; using Syste...
c sharp programming
// BY THE SPIRIT THE CREATOR OF THE WHOLE WORLD
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.SqlClient;
namespace testingFormuneDB
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection sqconnection;
SqlCommand sqlcommand;
string connectionstring = @"Data Source=.\SQLEXPRESS;AttachDbFilename=c:\users\abayomi\documents\visual studio 2010\Projects\testingFormuneDB\testingFormuneDB\testingMUNEProjDB.mdf;Integrated Security=True;User Instance=True";
bool flag = false;
private void btnsubmit_Click(object sender, EventArgs e)
{
bool resp= saveTotalbalance();
MessageBox.Show(resp.ToString());
}
public bool saveTotalbalance()
{
int mandatory = int.Parse(txtboxmandatory.Text);
int voluntary = int.Parse(txtboxvoluntary.Text);
int prevoiusbalance = int.Parse(txtboxpreviousbalance.Text);
int totalbalance = mandatory + voluntary + prevoiusbalance;
txtboxtotalbalance.Text = totalbalance.ToString();
sqconnection = new SqlConnection(connectionstring);
sqconnection.Open();
string commanntxt = "insert into repaymentTB (totalbalance) values('" + totalbalance + "') ";
sqlcommand = new SqlCommand(commanntxt, sqconnection);
sqlcommand.ExecuteNonQuery();
flag = true;
return flag;
}
public void retrivebalance()
{
sqconnection = new SqlConnection(connectionstring);
sqconnection.Open();
string commandtxt = "select totalbalance from repaymentTB ";
sqlcommand = new SqlCommand(commandtxt, sqconnection);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
SqlDataAdapter sqldatadapter = new SqlDataAdapter(sqlcommand);
sqldatadapter.Fill(ds);
dt = ds.Tables[0];
foreach (DataRow r in dt.Rows)
{
lblpreviousbalance.Text = r["totalbalance"].ToString();
}
sqconnection.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
retrivebalance();
}
}
}
c# for dummies: c sharp classes
c# for dummies: c sharp classes: USING LINQ TO SQL: nwind.Northwind db = new nwind.Northwind(@"Data Source=.\SQLEXPRESS;Initial Catalog=Northwind"); db.Log = Console.Out;...
Subscribe to:
Posts (Atom)