|
Hello Guys,
I have to connect to Oracle and SQL Server in my database projects. So I have to write the code to connect and query these tables...
I am looking for a class/assembly that provides connectivity/query facility for 2 databases (oracle and SQL Server).
I should be able to pass connection parameters from my application.
Then use the methods to query the database through the class/dll.
I have seen one @ DB Connectivity Provider[^]
If any one known of one please let know.
Thanks in advance
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
You can use Data Access Application Block from Enterprise Library: Link[^]
|
|
|
|
|
A little bit different approach: You can connect to Oracle from SQL Server and vice versa. After that you can for example define a view that actually hides where the data is coming from, so basically your application can connect to a single database and still get data from multiple databases but the application does not see it. In some cases this is easier to implement.
|
|
|
|
|
Hi,
I am developing a client/server socket program. From server number of time the Socket.send() is calling. I want to identify each message for different functions in the client side.
Eg:
Chat application:
When first connect a send message is send with welcome message. In client side it is displayed in a label. Next time the another message is send, that message should displayed a list box, Next time in text box…. There is no specific order for sending.
How can i identify the type of message
Regards,
Ypki
|
|
|
|
|
design your messaging spec such that each message has a type identifier in it. XML is good for this kind of stuff.
|
|
|
|
|
Better: use SOAP[^].
Instead of writing from scratch at the socket level, take into account using WCF[^]: it takes care of all the type resolution and serialization for you.
|
|
|
|
|
Wrap the message you are sending e.g.
when sending a connection message: "Connection|YourMessage"
for message to be added to listbox: "ListBox|YourMessage"
for message to be added to textbox: "TextBox|YourMessage", etc.
You can wrap your message with multiple key words to distinguish
e.g. "KeyWord1|KeyWord2|KeyWord3|.....|YourMessage"
Hope this helps,
Prateek
|
|
|
|
|
i've to find some records that matches with a given date once the search button is clicked. by default the datetime picker shows the current date. but i want to show all records when the date is not set by the user specifically,(and when Passportno and name fields are blank(defaut all fields are balnk))
1.how can i set the datetime picker value to balnk
2.is there better solution for this
|
|
|
|
|
|
Dear Team,
I have a requirement that
i am displaying the records in the datagrid which will are fetched from the database , which has 3 columns
1. id
2. the blob data
3. the file name ( this can be of any format ) like .txt,.pdf etc.
so when i click on the perticular file name ( which is just an name ) the file should get opened in its corresponding format by reading the data from its perticular blob column.
i am developing this in windows application.
expecting an responce from your side
Thanx and regards
|
|
|
|
|
OK, that describes your app . Now, may I ask you *what exactly* you need help with?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
actually i want to open the file which is stored in the database in blob format.
i was able to save that perticular file into any of folders in the system
sample code is here.
string ATTACHEMENTID1 = "";
private void DgToolsList_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
ATTACHEMENTID1 = DgToolsList.Rows[e.RowIndex].Cells[0].Value.ToString();
string FileName = DgToolsList.Rows[e.RowIndex].Cells[1].Value.ToString();
if (e.ColumnIndex == 1)
{
saveFileDialog1.Title = "Open File";
saveFileDialog1.Filter = "All Files|*.*|JPEG Images|*.jpg|GIF Images|*.gif|BITMAPS|*.bmp";
saveFileDialog1.FileName = FileName.ToString();
saveFileDialog1.ShowDialog();
//txtAttachment.Text = openFileDialog1.FileName;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
byte[] buffer = GetFileFromDB(ATTACHEMENTID1);
int ArraySize = new int();
ArraySize = buffer.GetUpperBound(0);
FileStream fs1 = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Write);
fs1.Write(buffer, 0, ArraySize);
fs1.Close();
MessageBox.Show("File Save to " + saveFileDialog1.FileName);
}
}
}
GetFileFromDB(string atachmenet) is the method to read the blog data from the database
but i want to open the file directly istead of saving it and open it again.
please provide me with some solution for it .
|
|
|
|
|
And what have you tried? Post some code with specific problems if you want help.
shaik abdul gani wrote: expecting an responce from your side
And do not demand things, its rude.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
sorry for that.
actually i want to open the file which is stored in the database in blob format.
i was able to save that perticular file into any of folders in the system
sample code is here.
string ATTACHEMENTID1 = "";
private void DgToolsList_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
ATTACHEMENTID1 = DgToolsList.Rows[e.RowIndex].Cells[0].Value.ToString();
string FileName = DgToolsList.Rows[e.RowIndex].Cells[1].Value.ToString();
if (e.ColumnIndex == 1)
{
saveFileDialog1.Title = "Open File";
saveFileDialog1.Filter = "All Files|*.*|JPEG Images|*.jpg|GIF Images|*.gif|BITMAPS|*.bmp";
saveFileDialog1.FileName = FileName.ToString();
saveFileDialog1.ShowDialog();
//txtAttachment.Text = openFileDialog1.FileName;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
byte[] buffer = GetFileFromDB(ATTACHEMENTID1);
int ArraySize = new int();
ArraySize = buffer.GetUpperBound(0);
FileStream fs1 = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Write);
fs1.Write(buffer, 0, ArraySize);
fs1.Close();
MessageBox.Show("File Save to " + saveFileDialog1.FileName);
}
}
}
GetFileFromDB(string atachmenet) is the method to read the blog data from the database
but i want to open the file directly istead of saving it and open it again.
please provide me with some solution for it .
|
|
|
|
|
Sorry, you are not making sense. Looking at your code, you read the data from the database and save it to a file. Simple enough. What doesn't make sense is
shaik abdul gani wrote: but i want to open the file directly istead of saving it and open it again.
So use the byte[] buffer that you populated from the database. Whats the problem?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Response: Looks like pretty straightforward and justified requirements.
|
|
|
|
|
I have a function which converts a bytearray to string. Following is the function :
//The bytearray value is getting from database. From the db, it is returning as varbinary.
-----------------------------------------------------
byte[] actual;
actual = target.GetFileBytes(projectFileId);
------------------------------------------------------
string strtest = "";
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
strtest = enc.GetString(actual);
This is working fine. But the issue is, when I check the variable strtest, I can see the value as two boxes with a question mark and commas. How should I get the correct string? Any help please?
Thanks
Meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi,
i would guess that ASCIIEncoding may not seem the correct encoding for your byte-array. How did you stored the file-bytes into your database? How did you converted the input string into the byte-array? And what kind of file is this? A plain text-file?
A workaround would be to store the byte-array as file and then to read the file to get the content as string.
Regards
Sebastian
|
|
|
|
|
You have to use the same encoding as was used to create the byte array before it was put in the database.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello
QUESTION 1:
If I want to handle properties of types under "System.Collections" is there a better way for me to rewrite the following?
Type oTypeInfo = lstCustomers.GetType();
if(oTypeInfo.PropertyType.NameSpace=="System.Collections") {
// do something accordingly
}
I don't like string comparison/substring and prefer not to hardcode "System.Collections". Anyway to do this? Prefer something out-of-the-box from .NET itself for instance
if(oTypeInfo.isCollection) { // This attrib does not exist unfortunately.
// do something
}
QUESTION 2:
How can instantiate generic type in runtime?
Type oTypeInfo = lstCustomers.GetType();
if(oTypeInfo.PropertyType.NameSpace=="System.Collections") {
// do something accordingly
CustomAttr<otypeinfo.propertytype> newAttrib = new CustAttr<otypeinfo.propertytype>;
newAttrib.Value = oInfo.GetValue();
this.myList.Add(newAttrib);
}
As you see, CustAttr is generic
class CustAttr<T> {
... bunch of stuff ...
}
Thanks
<div class="ForumMod">modified on Friday, December 5, 2008 4:52 AM</div>
|
|
|
|
|
devvvy wrote: I don't like string comparison/substring and prefer not to hardcode "System.Collections". Anyway to do this? Prefer something out-of-the-box from .NET itself for instance
if(oTypeInfo.isCollection) { // This attrib does not exist unfortunately.
// do something
You've got the right idea here. Check to see if the object is implementing ICollection.
if( lstCutomers is ICollection)
BTW: Hungarian notation is really on the way out.
|
|
|
|
|
1. is ICollection - works thanks!
2. Hungarian notation - code different languages and framework I no longer remember which is which!
3. any chance there's a way to instantiate generic <t> at runtime? (QUESTION 2)
Many thanks!~
dev
|
|
|
|
|
devvvy wrote: 3. any chance there's a way to instantiate generic at runtime? (QUESTION 2)
Last I checked, no there isn't. Generic types are determined and code written by the compiler at compile time. This is because Generics are "syntactic sugar", basically, writing overloaded code for you to handle each type (T) that the compiler finds instances of.
|
|
|
|
|
|
Dear all,
perhaps someone can help me. I'm trying to write a program that retireves information from my amazon seller account, but it fails to get the cookies Amazon sends me.
I have the following code:
CookieContainer cookies = new CookieContainer();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://www.amazon.de/gp/sign-in.html?ie=UTF8&email=...@web.de");
req.CookieContainer = cookies;
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
The cookies do not end up in the cookie container of the response, even though I can see them in the response header. Cookies from another website work.
I have now discovered that the program perhaps cannot handle the format of the set-cookie header correctly when parsing the cookies.
The cookies that don't work have the expiration date given as
Expires=Fri Dec 05 12:05:33 2008 GMT
while cookies from another host that can be parsed have it as
Expires=Fri, 05-Dec-08 12:05:33 GMT
Could this really be the cause for the cookie to be rejected by automatic parsing? If so, how can I set the format string for the application so it will parse the cookies correctly?
Any help is greatly appreciated
Reiner
|
|
|
|