|
Hi, I am sorry for some earlier posts as i was bit confused on my design of application...
Ok..I have BillDetails,Products,Packing Table...
And on winform I have gridview...Now in gridview I want to display billdetails table..but somehow the first two columns need to be combobox..and these combobox should take data from Products Table together with Packing..
I have screen shot as what exist in those tables..Also below is a small code that i have done but i see only one dropdown list with nothing populated...
Please HELP..I will really appreciate as i am stuck in it for few days
:confused:void fillData()
{
OleDbConnection database = new OleDbConnection(connectionString);
database.Open();
OleDbDataAdapter adapter1 = new OleDbDataAdapter("SELECT BillDetails.ProductID, BillDetails.ProductName, BillDetails.InQty, BillDetails.InBns, BillDetails.InPrice, BillDetails.Dis1, Products.packing, BillDetails.Saletype, BillDetails.SBtype, Products.FactorC, Products.FactorB, BillDetails.Type FROM Products INNER JOIN BillDetails ON Products.ProdID = BillDetails.ProductID", database);
DataGridViewComboBoxColumn dgridcolumn = new DataGridViewComboBoxColumn();
dgridcolumn.Name = "Products";
this.dataGridView1.Columns.Add(dgridcolumn);
DataTable dt = new DataTable();
DataTable packDT = new DataTable();
adapter1.Fill(dt);
dataGridView1.DataSource = dt;
adapter1.Fill(packDT);
dgridcolumn.DataSource = packDT;
dgridcolumn.ValueMember = packDT.Columns[1].ColumnName.ToString();
dgridcolumn.DisplayMember = packDT.Columns[1].ColumnName.ToString();
}
|
|
|
|
|
Hello everyone,
I am stuck with the following problem.
I have given text "We are living in a <upcase>yellow submarine</upcase>.", I have to change the text inside <upcase>....</upcase> to a uppercase letters so the result will be
"We are living in a YELLOW SUBMARINE."
Ill appreciate any help and suggestions how this can be done.
Thanks in advance!!
Regards
Georgi Uzunov
modified on Saturday, March 21, 2009 10:08 AM
|
|
|
|
|
How do you know which part should be in upper case? If it's always the same text you might as well just output the right output..
|
|
|
|
|
My fault the text should be "We are living in a <upcase>yellow submarine</upcase>.
So I have to replace upcase ...... /upcase with the uppercase text.
Apologies.
|
|
|
|
|
Try this.
string openTag = "<upcase>", closeTag = "</upcase>";
string str = "We are living in a <upcase>yellow submarine</upcase>.";
int startIndex = str.IndexOf(openTag);
int endIndex = str.IndexOf(closeTag) + closeTag.Length;
string subStr = str.Substring(startIndex, (endIndex - startIndex));
subStr = subStr.Replace(openTag, "");
subStr = subStr.Replace(closeTag, "");
subStr = subStr.ToUpper();
str = str.Remove(startIndex, (endIndex - startIndex));
str = str.Insert(startIndex, subStr);
hmmm pie
|
|
|
|
|
Thank you very much sir. It work like a charm Now I have to see how to put this in a loop so I can check bigger strings with more tags.
One more time Thanks.
Greetings!
|
|
|
|
|
Funny you should mention that as I was going to edit thte above code for multiple tags.
private string upperCaseTags(string str, string openTag, string closeTag)
{
int startIndex;
while ((startIndex = str.IndexOf(openTag)) != -1)
{
int endIndex;
if ((endIndex = str.IndexOf(closeTag) + closeTag.Length) != -1)
{
string subStr = str.Substring(startIndex, (endIndex - startIndex));
subStr = subStr.Replace(openTag, "").Replace(closeTag, "").ToUpper();
str = str.Remove(startIndex, (endIndex - startIndex));
str = str.Insert(startIndex, subStr);
}
}
return str;
}
hmmm pie
|
|
|
|
|
One more time great job. You did it instead of me.
Thank you!
|
|
|
|
|
This can be improved by Regular Expression's Replace[^] method.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Can they be nested?
If they can't, search the string for "<uppercase>" and "</uppercase>" and turn all substrings starting at index[2*i] ending at index[2*1+1] to uppercase (won't work correctly for invalid inputs but the idea is easily extended to using 2 index arrays)
|
|
|
|
|
sounds to me perfect case for Regular Expression. See Replace method of RegEx[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Ill check this method.
Thank you!!
Greetings
|
|
|
|
|
Regard with the strings may I ask one more question. I have to write a simple program to encode and decode string using encryption key.The encoding and decoding is performed by using XOR.
So Ive done encoding part
static void Main(string[] args)
{
string str= "19 5456 65";
string key = "546";
String encode = Encode(str, key);
String decode = Encode(encode, key);
Console.Write(str + "\n" + encode+"\n"+decode);
}
static string Encode(string str,string key)
{
char []keyChar = key.ToCharArray();
char[] strChar = str.ToCharArray(); int a = 0;
for (int i = 0; i < strChar.Length;i++ )
{
strChar[i] = (char)(strChar[i] | keyChar[a]);
a++;
if (a>keyChar.Length-1)
{
a = 0;
}
}
str = new string(strChar);
return str;
}
But when I try to decode those string its giving me the same encoded string.
Please if any one knows where I am wrong to help me.
Thanks!!!
|
|
|
|
|
How can I use DLL file in C#.NET ? I create dll in Borland C++ Compiler 5.5.1 and using C language.
Following code is not work.
My C Code;
-----------------------------------------------------
//hello.dll
#include <windows.h>
extern "C"
{
void __declspec (dllexport) function1()
{
MessageBox (NULL, "test message","test title",0);
}
}
BOOL WINAPI DllMain (HINSTANCE, DWORD, LPVOID)
{
return TRUE;
}
My C# Code;
-----------------------------------------------------
[DllImport("C:\hello.dll")]
public static extern void function1();
private void button1_Click(object sender, EventArgs e)
{
function1();
}
|
|
|
|
|
Does it give an exception (if so, what kind?) or does it just silently fail?
|
|
|
|
|
Ok, I try this; But I get this error: Entry Point Not Found
C DLL CODE
-----------------------------------------------
#include <windows.h>
BOOL __stdcall DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) {
return TRUE;
}
__declspec(dllexport) void __stdcall Message(char* p_szMessage) {
MessageBox(NULL, p_szMessage, "Message from DLL", MB_OK);
}
C# DLL CODE
-----------------------------------------------
[DllImport("filename.dll")]
static extern void Message(string msg);
private void button1_Click(object sender, EventArgs e)
{
Message("Hello world");
}
|
|
|
|
|
Just put hello.dll in C:\WINDOWS\system32
and replace [DllImport("C:\hello.dll")] with [DllImport("hello.dll")]
IS that give any error or exception??
|
|
|
|
|
I get this error: Entry Point Not Found
|
|
|
|
|
|
following article may help
http://www.codeproject.com/KB/cs/dyninvok.aspx[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
No, this article not related about my question.
I use Borland Compiler. Is it occour problem?
|
|
|
|
|
Article XMen has linked will tell you how to check if library that you have compiled exports symbol (function) you are referring to. So try that one, this can give you some hint.
|
|
|
|
|
this is my code plz help me here is my code.
public partial class customresearch : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("database=researchmind;Data Source=NEWSOFT;User id=sa;Password=abc123");
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter();
da = new SqlDataAdapter("insert into customresearch_t(title,firstname,lastname,jobtitle,company,address1,address2,"
+ "city,state,zipcode,country,email,phone,fax,description,find) values('" + ddlTitle.SelectedValue.ToString() + "','"
+ txtFirst.Text + "','" + txtLast.Text + "','" + txtJobtitle.Text + "','" + txtCompany.Text + "','" + txtAddress1.Text + "','"
+ txtAddress2.Text + "','" + txtCity.Text + "','" + txtState.Text + "','" + txtZipcode.Text + "', '" + ddlCountry.SelectedItem.ToString() + "','"
+ txtEmail.Text + "','" + txtphone.Text + "','" + txtFax.Text + "','" + txtDesc.Text + "','" + ddlFind.SelectedValue.ToString()+ "' )", cn);
da.Fill(ds);
string filepath = Server.MapPath(Request.ApplicationPath + "//");
string filename = Path.GetFileName(filepath);
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] bytes = br.ReadBytes((Int32)fs.Length);
br.Close();
fs.Close();
string query = "insert into uploadfile_t(Name,ContentType,Data) values (@Name,@ContentType,@Data)";
SqlCommand cmd = new SqlCommand(query);
cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = filename;
cmd.Parameters.Add("@ContentType", SqlDbType.VarChar).Value = "ContentType";
cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes;
//cmd.Parameters.Add("@requirement", SqlDbType.VarChar).Value = "application/vnd.ms-word";
InsertUpdateData(cmd);
}
private Boolean InsertUpdateData(SqlCommand cmd)
{
cmd.CommandType=CommandType.Text;
cmd.Connection=cn;
try
{
cn.Open();
cmd.ExecuteNonQuery();
return true;
}
catch(Exception ex)
{
Response.Write(ex.Message);
return false;
}
finally
{
cn.Close();
cn.Dispose();
}
}
}
the following error will come
Could not find a part of the path 'C:\Documents and Settings\icon\Desktop\researchmind\'.
plz any one help me
any file will save and retrieve from db
|
|
|
|
|
wrong
string filepath = Server.MapPath(Request.ApplicationPath + "//");
string filename = Path.GetFileName(filepath);
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
correct
string filepath = Server.MapPath(Request.ApplicationPath + "//");
string filename = Path.GetFileName(filepath);
FileStream fs = new FileStream(filepath <code>+ filename</code>, FileMode.Open, FileAccess.Read);
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i changed as you given but the same problem will come. i want to any type of file upload into the db,the same will retrieve into the gridview
Could not find a part of the path 'C:\Documents and Settings\icon\Desktop\researchmind\'.
|
|
|
|
|