Click here to Skip to main content
15,921,905 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic18-Feb-14 23:03
computerpublic18-Feb-14 23:03 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming19-Feb-14 1:59
mveRichard Deeming19-Feb-14 1:59 
GeneralRe: Converting Back from Bit to Byte Pin
computerpublic13-Mar-14 8:16
computerpublic13-Mar-14 8:16 
AnswerRe: Converting Back from Decimal to Byte Pin
Eddy Vluggen12-Feb-14 11:21
professionalEddy Vluggen12-Feb-14 11:21 
QuestionRe: Converting Back from Decimal to Byte Pin
Richard MacCutchan12-Feb-14 21:38
mveRichard MacCutchan12-Feb-14 21:38 
Questiontreeview and database Pin
danmor49812-Feb-14 6:45
danmor49812-Feb-14 6:45 
QuestionRe: treeview and database Pin
Ravi Bhavnani12-Feb-14 7:28
professionalRavi Bhavnani12-Feb-14 7:28 
AnswerRe: treeview and database Pin
danmor49812-Feb-14 7:52
danmor49812-Feb-14 7:52 
in fact I am trying to build a snippet database for my personnel use
All the one I have seen where a bit complicated to work with
I want to create mine. It will more likely help to understand more the logic behind it
and for the other project that I have with treeview

I am Using SqlCe 3.5 and up.

For the database I have done it this way

C#
static public String Dpath = Application.StartupPath + "\\Data\\";
        static public String DB_NAME = Dpath + Application.ProductName + ".sdf";
        static public String DB_PWD = "";
        static public string sql;
        static private string _filename;
        static public string filename
        {
            get { return _filename; }
            set { _filename = value; }
        }
        static private string _filecontent;
        static public string filecontent
        {
            get { return _filecontent; }
            set { _filecontent = value; }
        } 
  static public string ConnectString()
		{
			string connectionString = string.Format("DataSource=\"{0}\"; Password=\"{1}\"", DB_NAME, DB_PWD);
			return connectionString;
		}

		static public void CreateDB()
		{
			SqlCeEngine en = new SqlCeEngine(ConnectString());
			en.CreateDatabase();
			en.Dispose();
			en = null;
		}

		static public void CreateTable(string TName)
		{
			SqlCeConnection cn = new SqlCeConnection(ConnectString());
			if (cn.State == ConnectionState.Closed)
			{
				cn.Open();
			}
			SqlCeCommand cmd;
			sql = "create table " + TName + "("
				+ "ID INT IDENTITY (1,1) PRIMARY KEY not null, "
				+ "FileName NVarChar(50), "
				+ "FileContent NTEXT)";
			cmd = new SqlCeCommand(sql, cn);
			cmd.ExecuteNonQuery();
			cn.Close();
		}


If there is a better way of doing it it will be appreciated

Thank'a Lot
Daniel

QuestionRe: treeview and database Pin
Richard MacCutchan12-Feb-14 21:27
mveRichard MacCutchan12-Feb-14 21:27 
AnswerRe: treeview and database Pin
danmor49813-Feb-14 8:58
danmor49813-Feb-14 8:58 
GeneralRe: treeview and database Pin
Richard MacCutchan13-Feb-14 21:45
mveRichard MacCutchan13-Feb-14 21:45 
QuestionASP.NET Project Files Pin
Sandhya Bandar12-Feb-14 2:29
Sandhya Bandar12-Feb-14 2:29 
AnswerRe: ASP.NET Project Files Pin
Richard MacCutchan12-Feb-14 4:42
mveRichard MacCutchan12-Feb-14 4:42 
QuestionThe file version maintain utility Pin
sahani from india12-Feb-14 1:56
sahani from india12-Feb-14 1:56 
AnswerRe: The file version maintain utility Pin
Pete O'Hanlon12-Feb-14 2:16
mvePete O'Hanlon12-Feb-14 2:16 
GeneralRe: The file version maintain utility Pin
OriginalGriff14-Feb-14 22:27
mveOriginalGriff14-Feb-14 22:27 
QuestionHelp needed XNA and Window Forms Pin
larsp77712-Feb-14 0:57
larsp77712-Feb-14 0:57 
AnswerRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:09
professionalDaveyM6912-Feb-14 1:09 
GeneralRe: Help needed XNA and Window Forms Pin
larsp77712-Feb-14 1:13
larsp77712-Feb-14 1:13 
GeneralRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:39
professionalDaveyM6912-Feb-14 1:39 
GeneralRe: Help needed XNA and Window Forms Pin
larsp77712-Feb-14 4:34
larsp77712-Feb-14 4:34 
GeneralRe: Help needed XNA and Window Forms Pin
Pete O'Hanlon12-Feb-14 4:50
mvePete O'Hanlon12-Feb-14 4:50 
AnswerRe: Help needed XNA and Window Forms Pin
Marco Bertschi12-Feb-14 1:40
protectorMarco Bertschi12-Feb-14 1:40 
QuestionRegEx problem with Escape sequences Pin
Marco Bertschi11-Feb-14 23:30
protectorMarco Bertschi11-Feb-14 23:30 
SuggestionRe: RegEx problem with Escape sequences Pin
Kornfeld Eliyahu Peter11-Feb-14 23:39
professionalKornfeld Eliyahu Peter11-Feb-14 23:39 

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.