How to upload image from C# application to SQL Server 2005 -


संभव डुप्लिकेट:

सी # एप्लिकेशन से SQL सर्वर 2005 में छवि कैसे अपलोड करें

  का उपयोग करके (SqlConnection Conn = नई SqlConnection ("कॉन्फ़िगरेशन स्ट्रिंग" ["ConnectionString"] ConnectionString) {try {const स्ट्रिंग एसक्यूएल = "[द्विपदीय में शामिल करें] ([फ़ाइलनाम], [दिनांकटाइम अपलोड], [एमआईएमई], [बाइनरीडेटा]) मूल्य (@फ़ाइलनाम, @ डेटटाइमअपलोडेड, @ एमएमईएम, @ बाइनरीडाटा) "; SqlCommand सीएमडी = नया एसक्यूएल कॉमांड (एसक्यूएल, कॉन); Cmd.Parameters.AddWithValue ("@ फ़ाइलनाम", फ़ाइलनाम। Text.Trim ()); Cmd.Parameters.AddWithValue ("@ MIME", FileToUpload.PostedFile.ContentType); बाइट [] imageBytes = नया बाइट [FileToUpload.PostedFile.InputStream.Length + 1]; FileToUpload.PostedFile.InputStream.Read (imageBytes, 0, imageBytes.Length); Cmd.Parameters.AddWithValue ("@ BinaryData", imageBytes); Cmd.Parameters.AddWithValue ("@ दिनांकटाइमअपलोडेड", दिनांकटाइम.अब); Conn.Open (); cmd.ExecuteNonQuery (); Lit_Status.Text = "& lt; br / & gt; फ़ाइल सफलतापूर्वक अपलोड की गई - धन्यवाद। & Lt; br / & gt;"; Conn.Close (); } पकड़ {Conn.Close (); }}   



Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -