|
You may want to consider using Antlr[^]. It has grammars for various languages.
|
|
|
|
|
You will need a proper parser for that. Regex with suffice as a tokenizer, but not for grammar parsing. I suggest you go with something like: GPPG[^].
|
|
|
|
|
DataTable mytable = new DataTable();
This is the code. :->
Please elobrate what exactly you are looking for?
|
|
|
|
|
Hi,
If you are looking to create a new data table schema in VC# then below is the code:
DataTable dt = new DataTable("tblName");
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Age", typeof(int));
dt.AcceptChanges();
If u need any thing specific, let me know.
|
|
|
|
|
He just told you how to do it in C#.
|
|
|
|
|
Hello ,iam fresher
iam developing quiz application in that i have 36 qns.Requirement is upto 34 questions the data stored like int after that means 35 and 36 questions(feedback question )data is stored as a string. Upto 34 questions the datastored in database is int but after that it is not storing.
iIndex for count questions
<pre>
int iIndex = 1;
for(int iCount=0; iCount <iTotal ; iCount++)
{
iIndex = iCount + 1;
SqlCommand cmd=new SqlCommand("insert into tbl_quiz_answer values("+userid+","+ iIndex +",'"+strAns[iCount]+"')");
cmd.Connection = con;
cmd.ExecuteScalar ();
}
con.Close();
srinivas
|
|
|
|
|
srinivassam wrote: Requirement is upto 34 questions the data stored like int after that means 35 and 36 questions(feedback question )data is stored as a string.
What does that mean?
You can't store different datatypes in the same column, if that's what you're trying to do. You have two choices:
1. Use a separate table for storing the feedback.
2. Store all the answers as strings and convert them after you query the database.
Also, do not use string concatenation to build queries. Have a look at SQL injection.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
hello.
change the datatype in database for index to either something bigger integer value,
or string, and then perform conversion form string to int and vice versa at front-end.
the first approach is more convenient.
good luck.
|
|
|
|
|
Hi, How you can store string data into an int column, i dint get it. The vice-cersa can happen but not this.
Moreover u shud alwayz make a standard to use parametrised query and not concatenate it or u will introduce a vulnerability to SQL injection attack.
parametrised query is formed like this.
SqlCommand sql_cmd = new SqlCommand("insert into Info values(@id,@name,@age)");
sql_cmd.Parameters.Add("@id", SqlDbType.Int);
sql_cmd.Parameters.Add("@name", SqlDbType.NVarChar);
sql_cmd.Parameters.Add("@age", SqlDbType.Int);
sql_cmd.Parameters["@id"].Value = int.Parse(textBox1.Text);
sql_cmd.Parameters["@name"].Value = "Aman";
sql_cmd.Parameters["@age"].Value = 23;
sql_cmd.ExecuteNonQuery();
try, re-typing the column to varchar if it does not necessarily need to store int data, this should solve the problem or else try parsing your string data to int like int.parse(<string value="">);
|
|
|
|
|
Hi All,
I have one web project which was working fine but after i enable SSL, i could open the project by having the error below:
"The web server reported the following error when attempting to create or open the web project located at the following URL : Http://localhost/download.aspx', HTTP/1.1 403 Access Forbidden"
Another clue that i have is the the cert name that someone created is called "PENEDITEST.pen.apac.com", but my testing server name is "PENEDITEST01", i am not sure whether is it because of this reason that making the error pop up.
Kindly Advice.
Regards,
Lygine
|
|
|
|
|
i send 6 + 1 (6 variables and one starting byte)data from microcontroller to c#.first character is ZERO .and it means next value is first value.another meaning zero will be starting byte.how can i latch zero than save other variables to my array?
|
|
|
|
|
What are these 6 variables you're talking about? Ints of 4 bytes? Ints of 2 bytes? Just bytes?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
each of data is just one byte.(between 0-255)
|
|
|
|
|
OK, now how do you get this data into your application? Do you have a method that gets passed these 7 bytes as an array? Are you reading it as a stream? I'm trying to help, but you're not providing enough information.
Unfortunately, I don't have access to webmail at work, so I can't see the reply notifications
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
All of my microcontroller codes :
#include "C:\Documents and Settings\yasin\Desktop\yeni\deneme3.h"
#include <16F877.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,HS, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
void main()
{
int8 value1,value2,value3,value4,value5,value6;
int8 start;
value1=1;
value2=2;
value3=3;
value4=4;
value5=5;
value6=6;
start=0;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
for(;;)
{
delay_ms(10);
putc(start);
putc(value1);
putc(value2);
putc(value3);
putc(value4);
putc(value5);
putc(value6);
}
C# codes:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace serial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
serialPort1.DataReceived += new SerialDataReceivedEventHandler(this.serialPort1_DataReceived);
if (serialPort1.IsOpen)
serialPort1.Close();
serialPort1.ReceivedBytesThreshold = 1;
serialPort1.DataBits = 8;
serialPort1.Parity = System.IO.Ports.Parity.None;
serialPort1.StopBits = System.IO.Ports.StopBits.One;
serialPort1.BaudRate = 9600;
serialPort1.PortName = "COM4";
serialPort1.Open();
}
public delegate void updatetexboxes();
byte[] received ={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
int i=0;
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
serialPort1.Read(received, i, 1);
//i dont know which codes can be written here!!!!
//than i ll update my variables.
this.Invoke(new updatetexboxes(this.updatetext));
}
private void updatetext()
{
textBox1.Text = received[1].ToString();
textBox2.Text = received[2].ToString();
textBox3.Text = received[3].ToString();
textBox4.Text = received[4].ToString();
textBox5.Text = received[5].ToString();
textBox6.Text = received[6].ToString();
}
}
}
|
|
|
|
|
You've only given some of the C# code. Look at a file called Form1.Designer.cs, or something similar. Here are some tips to get you started:
1. I don't see a definition for serialPort1. What type is it?
2. What does serialPort1.Read() return, if anything?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
i use serialport component from toolbox.i get datas.cause i use breakpoints so i see my variables content.
|
|
|
|
|
Hi,
i want to pick up a file or correctly if i say, if there exist a text file then i want to read the contents of that file then want to send those content to another destination.
the software on which i am working is like Message sender/receiver, so i have to send that content as message to other destination.
so, is there any way by which i can pick a file, i m using c#.net as plateform.
And its my humble request, plz clarify in detail as i m not that good in programming and got confused easily. As i m still in phase of learning.
|
|
|
|
|
|
Hi humdumof, C#.NET provides a namespace System.IO which can be used for handling files and a class StreamReader and StreamWriter which can be used to read from or write to a file. As shown below
<br />
string path = @"D:\file.txt";<br />
<br />
if (File.Exists(path))<br />
{<br />
using (StreamReader sr = new StreamReader(path))<br />
{<br />
textBox1.Text = sr.ReadToEnd();<br />
sr.Close();<br />
}<br />
using (StreamWriter sw = new StreamWriter(@"D:\newfile.txt"))<br />
{<br />
sw.WriteLine(textBox1.Text);<br />
sw.Close();<br />
}<br />
}<br />
else<br />
{<br />
MessageBox.Show("File does not exist.");<br />
}<br />
This code first checks for the existence of the file and if present, it reads the content to a textbox and then copies/send the same data to other destination file, else, reads an error message. Hope it helps you.
|
|
|
|
|
i want add one property to my control.when i put mouse in that property i want to open one more window.same like datagrid table styles.How can i make a property like that?....................
|
|
|
|
|
Go and buy a book on winforms basics, or google and read up.
|
|
|
|
|
Please give code for checking the valid username and password from database
|
|
|
|
|
|
try {
SqlConnection con = new SqlConnection("connectionstring");
string sqlQuery = "select user,pwd from Login where user= ' " + this.TextBox1.Text + " ' and pwd=' " + this.TextBox2.Text + " ' ";
con.Open();
SqlCommand com = new SqlCommand(sqlQuery, con);
int results = com.ExecuteScalar;
if (results == 1)
{
return true;
}
else
{
return false;
}
con.Close();
com.Dispose();
}
catch (SqlException ex) {
MessageBox.Show(ex.ToString);
}
|
|
|
|
|